NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
July 29, 2014, 05:39:40 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"In theory, theory and practice are the same. In practice, they are not." ..."Albert Einstein (1879~1955, Mathematical physicist, Nobel Prize 1921-Physics)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1] 2 3   Go Down
  Print  
Author Topic: Ejs open source java applet 1D collision carts Elastic and Inelastic Collision  (Read 51234 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
on: December 23, 2008, 02:10:01 pm » posted from:-,-,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

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

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
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!


*** There are 4 more attached files. You need to login to acces it!
« Last Edit: March 26, 2012, 04:06:23 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #1 on: December 30, 2008, 09: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:\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! Smiley

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 Huh 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 Roll Eyes 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 » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #2 on: December 31, 2008, 09:58:28 am » posted from:Taipei,T'ai-pei,Taiwan

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. :-)
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: December 31, 2008, 10: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, 09:29:18 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: January 03, 2009, 10:53:58 am »

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.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #5 on: January 03, 2009, 04:30:15 pm »

I just tried it. It seems to work fine.
Set the Transform property to wheelAngle should be fine.
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #6 on: January 03, 2009, 09:35:59 pm »

can look at my xml, wheel01 and wheel02 have transformation but they do not rotate.

it is puzzling me Huh
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #7 on: January 03, 2009, 11:15:40 pm »

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).
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #8 on: January 04, 2009, 08:27:42 pm » posted from:Singapore,,Singapore

(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
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #9 on: January 19, 2009, 04:35:31 pm » posted from:-,-,SINGAPORE

Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang


*** There are 1 more attached files. You need to login to acces it!
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #10 on: February 10, 2009, 01:09:21 pm » posted from:Singapore,,Singapore

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


*** There are 2 more attached files. You need to login to acces it!
« Last Edit: February 16, 2009, 01:58:12 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #11 on: February 17, 2009, 04:02:37 pm » posted from:-,-,SINGAPORE

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


*** There are 2 more attached files. You need to login to acces it!
« Last Edit: February 24, 2009, 01:43:58 pm by lookang » Logged
LeeTl
Jr. Member
**
Offline Offline

Posts: 24


WWW
«
Embed this message
Reply #12 on: February 19, 2009, 04: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
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #13 on: February 19, 2009, 07:55:05 am » posted from:Singapore,,Singapore

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 Smiley
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 » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #14 on: February 20, 2009, 01:05:48 pm » posted from:-,-,SINGAPORE

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 Huh?

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 


* SS-20090220140525.png (25.86 KB, 596x398 - viewed 131 times.)

* Screen shot 2010-05-22 at PM 09.12.32.png (41.27 KB, 618x419 - viewed 120 times.)

* Screen shot 2010-05-22 at PM 09.15.42.png (33.01 KB, 468x313 - viewed 86 times.)

* Screen shot 2010-05-22 at PM 09.18.47.png (24.28 KB, 511x197 - viewed 91 times.)

* Screen shot 2010-05-22 at PM 09.20.05.png (16.65 KB, 608x189 - viewed 93 times.)

* Screen shot 2010-05-22 at PM 09.23.15.png (72.67 KB, 904x614 - viewed 85 times.)

* physletcollision.PNG (27.61 KB, 575x671 - viewed 98 times.)
« Last Edit: September 29, 2010, 10:24:11 am by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
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!  Cheesy
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #16 on: February 20, 2009, 02:27:52 pm » posted from:-,-,SINGAPORE

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

I love open source
« Last Edit: February 20, 2009, 03:07:15 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
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??

}//  x1 = -2*radius1+x2+2*radius1;
// x2 = x1+2*radius1-2*radius1;
 
}
could it be the i have codes is causing the codes not to work?
it look correct but don't know why nothing happens like i intended with the codes.


* overlap.PNG (57.43 KB, 1280x1024 - viewed 133 times.)

*** There are 1 more attached files. You need to login to acces it!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
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.
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
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!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
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!
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #21 on: March 03, 2009, 10:52:30 pm »

thanks! will do some housekeeping.



*** There are 3 more attached files. You need to login to acces it!
« Last Edit: March 18, 2009, 11:03:13 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
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. Cheesy
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #23 on: March 19, 2009, 06:54:09 am » posted from:Taipei,T'ai-pei,Taiwan

Great! I hope students can enjoy the fun of physics playing the inquiry activity!
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #24 on: March 21, 2009, 04:30:19 pm »

it is true that after a XML file reach a certain file size say 250 KB, the EJS seems to be a bit laggy during the open file process?



mine like stuck a long time, hope the  file is not corrupted or something.

If you got time, can try to open this file attached ?

thanks!


*** There are 3 more attached files. You need to login to acces it!
« Last Edit: March 21, 2009, 07:10:04 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
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.).
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #26 on: March 22, 2009, 06:24:27 pm »

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 ?

Thanks!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #27 on: March 22, 2009, 06:59:38 pm » posted from:Taipei,T\'ai-pei,Taiwan

Downloaded jar file work fine.
The problem is: this page was not able to show the applet properly.
Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #28 on: March 22, 2009, 09:49:08 pm »

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!!!

thanks for testing on your end prof !

i will delete the test posts now!


* bug with group2d after exporting.PNG (27.69 KB, 593x507 - viewed 97 times.)

*** There are 2 more attached files. You need to login to acces it!
« Last Edit: March 22, 2009, 09:59:09 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1728


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #29 on: March 23, 2009, 08:59:25 pm »

i don't understand why it fail to load the web applet. now again. strange
Logged
Pages: [1] 2 3   Go Up
  Print  
"In theory, theory and practice are the same. In practice, they are not." ..."Albert Einstein (1879~1955, Mathematical physicist, Nobel Prize 1921-Physics)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Perfectly inelastic collision
Dynamics
Fu-Kwun Hwang 0 3414 Last post February 20, 2010, 11:22:34 am
by Fu-Kwun Hwang
1 D collision carts Elastic and Inelastic Collision
dynamics
ahmedelshfie 6 7380 Last post April 27, 2010, 02:16:18 am
by ahmedelshfie
Ejs Open Source 2D Collision Model java applet
Collaborative Community of EJS
lookang 1 6652 Last post May 19, 2011, 10:56:16 pm
by lookang
Ejs open source java applet 1D collision force model
Collaborative Community of EJS
lookang 8 4033 Last post March 26, 2012, 01:36:57 pm
by engrg1
Ejs open source java applet 1D collision carts with realistic collision
Collaborative Community of EJS
lookang 4 5129 Last post February 19, 2013, 01:05:56 pm
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.862 seconds with 23 queries.since 2011/06/15