# NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

## Easy Java Simulations (2001- ) => Collaborative Community of EJS => Topic started by: lookang on March 26, 2012, 04:14:19 pm

 Title: Ejs open source java applet 1D collision carts with realistic collision Post by: lookang on March 26, 2012, 04:14:19 pm Ejs open source java applet 1D collision carts with realistic collision!based on an earlier work by Paco and lookanghttp://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=831.0Thanks To Professor Fu-Kwun Hwang for guidance and Professor Francisco Esquembre for EJS and the open source digital library source codes.special mention to engrg1 for the research done on the spring force model for all cases of e.[ejsapplet]the codes by engrg1 was especially useful for this final version :)public double impactForce (double xa,double xb, double va ,double vb){     double f;     double y;     double x;     double z;     double a;     a=0;   // using the impact force equaion provided by Objalvo and Cohen ,1 1997// Damping coefficient based on Brach, 1991a// Formula can be found Pg 3 of http://www.brachengineering.com/publications/SAE%202003-01-0491.pdf// this equation is not perfect and can only give a good estimate of the coefficient of resistutionif (es>0.05) {  x =Math.log(es)*Math.log(es);  z = Math.sqrt( x/( Math.PI* Math.PI+x));  } else z=1;    if(xa    f= klinear*((xb-xa)-L); // change to 2*L by lookang  else     f = klinear*(L-(xa-xb)); // change to 2*L by lookang   y = mass1*mass2/(mass1+mass2);  if(Math.abs(xa-xb)     a= -2*z*(Math.sqrt(klinear*y))*(va-vb) + f;     }  s_z = "a= " + double2String(a,1000) +"size= " + double2String(2*radius1,1000) ;  return a;  } Title: Re: Ejs open source java applet 1D collision carts with realistic collision Post by: lookang on April 02, 2012, 04:20:22 pm discussion with teacherWe seek your help to change the aesthetic part of the simulation - can the velocity vector of the right cart point to the left and display 1.25 m/s. (pls refer to attached pic)We need this badly cos this is the convention all aj teachers use.done a while back as convention 2 Title: Re: Ejs open source java applet 1D collision carts with realistic collision Post by: lookang on December 12, 2012, 02:05:14 pm The refinements are almost donehttp://weelookang.blogspot.sg/2012/11/address-learning-difficulties-in.htmleduLab AJC page:https://sites.google.com/site/lookang/collision-carts-dynamics-ajcdownload and also attachedhttps://sites.google.com/site/lookang/collision-carts-dynamics-ajc/ejs_Momentum1DForceModel01.jar?attredirects=0&d=11.   change in area size to mass for visual impact, area change according to mass now.2.   clearer arrows of contact force, done.3.   some other fixes like better graphics control click 1 show all mom,ke,forces4.   mouse and elephant graphics, I doubt it helps but I will try with your pictures, you wish to provide your picture of a mouse and elephant? Title: Re: Ejs open source java applet 1D collision carts with realistic collision Post by: lookang on January 15, 2013, 12:11:45 pm from teacherI have tried your new simulation and found the improvements in visual much better.  I think it is not necessary to change the mouse and elephant.However, I do note some areas that perhaps need your attention.1. There was a pause function earlier on but it is missing now? It stops the simulation at the moment of impact.added at instant of |F| > 0.0 N very precise2. This is somewhat more serious.  When the simulation is paused in the middle of the collision, the calculations go haywire and the graph shows a blip. I have attached a screen capture of the blip below. I suspect the calculations restart from zero and hence the blip. i don't see it as shown, but i made a dt slow down? it should be able to calculate accurately given the smaller dt steps3. Is it possible to reduce the length of the arrow for velocity proportionately? I mean when I set it to 3 ms-1, it crosses  over to the other body. The thickness of the arrow is appreciated, but the length is a bit too long. Perhaps it should only reach the other body if the velocity is set to 10 ms-1, and the length decreases proportionately when the value is decreased.done it is even smaller now, about 0.5 timesThanks so much for your help!no problem Title: Re: Ejs open source java applet 1D collision carts with realistic collision Post by: lookang on February 19, 2013, 01:05:56 pm discussion with another teacher lim e.p.1 there is a checkbox for velocity that switches the arrows.The arrow does not agree to the sign of velocity. There is no checkbox. teacher was using an earlier version.2 the data up ok. i go play firstwhat is the name of the ipad app?.Mass in motion (quite user friendly)3. the sliders are already grouped together, maybe i bordered thicker could you section up the mass, velocity of one mass? top and bottombecause of this teacher's suggestion, the applet is improved to https://dl.dropbox.com/u/44365627/lookangEJSworkspace/export/ejs_Momentum1DForceModel02.jar