Title: A real time clock created with EJS4 Post by: Fu-Kwun Hwang on February 20, 2009, 10:01:59 pm This applet is created with EJS 4. You can find out how to find information about world time with java.
-*- Title: Re: A real time clock created with EJS4 Post by: chumunroshan on February 22, 2009, 10:59:14 pm thanks. that was very useful
Title: Re: A real time clock created with EJS4 Post by: lookang on February 24, 2009, 09:08:32 am i have discussion of collection of clock telling time digital interactive over here http://66.7.205.91/~lookangc/index.php?topic=333.msg752#msg752
some of the people here might be interested to look at them to get good ideas/features to modify the EJS open source version by Prof. Fu-Kwun Hwang EJS could be a future platform for virtual labs/simulations for collaborations under creative commons licenses. Title: Re: A real time clock created with EJS4 Post by: lookang on June 02, 2011, 01:12:00 pm strange when i download the source xml and recompile it in Ejs 4.3.31 or 4.27.
on drag of the sliders, the clock goes all over the clock unlike the version above. any idea what is wrong? ;D Title: Re: A real time clock created with EJS4 Post by: lookang on August 22, 2011, 04:05:03 pm Dear Prof Hwang,
I tried to remix the clock. but i could not replicate the drag on of the minute and hour hand in your simulation model to have a second hand drag-able with the perfect transition of the second hand from 1 to 59. I have created a second hand drag-gable ( http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2276.0 ) but with bugs i cannot eliminated thus, i seek your help :) i do not understand the codes inside the minute hand and the hour hand. for example: in the minute hand ctam=Math.atan2(mx,my);// ctaangle of minute hand if(ctam<0)ctam+=pi2; vm=(int)(ctam/pi2*T); if(Math.abs(vm-vms)>40.){// why 40? arbitrary if(vms<30){ // why 30? i thought it should be 60 minutes? vh=vh-1; // original was vh+=1; i think testm=-1; // my codes to debug which lines is executed } else if(vms>30){ // why 30? i thought it should be 60 minutes? vh=vh+1; testm=1; // my codes to debug which lines is executed } if(vh==12 || vh==0){ // this should not impact the drag right? i have not implemented it if(hadd>0)hadd=0; else hadd=12; if(hours24)vh2=vh+hadd; } } set(); //cta=(vs+vm*60+vh*3600*5)*pi2/T; where public void set () { vs=vs+vm*60+vh*3600*5; cta=vs*pi2/T; } could i request 1 thing? ;D an add-on to your simulation to have the second hand drag-gable without the bugs i have created in my remixed sim found here http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2276.0 please add some useful comments lines // so i can follow the program logic more closely to your thoughts. Thanks!! Title: Re: A real time clock created with EJS4 Post by: Fu-Kwun Hwang on August 23, 2011, 12:38:22 am The angle for minute hand is vm, vms is previous angle
Quote if(vms<30){ // why 30? i thought it should be 60 minutes? ctam=Math.atan2(mx,my); vm=(int)(ctam/pi2*T); The angle is zero degree when value for minute is 15. The angle for minute=0 is 30 degree. if(vms<30)vh--;// counterclockwise rotating so hour value decrease by 1: vh-- is the same as vh=vh-1; else if(vms>30)vh++;// clockwise rotating so hour value increase by 1: vh++ is the same as vh=vh+1; if(Math.abs(vm-vms)>40.){// this is related to how fast user drag it, the value was found by try and error (I think) Title: Re: A real time clock created with EJS4 Post by: lookang on August 23, 2011, 01:11:28 pm dear prof!
i discovered a bug that i cannot solve alone. maybe you can see if it can be solve? attached is the animated gif the bug occurs when the hand hour is drag pass the 12 mark, to the left can produced the bug ( the hour hand jumps to 11 instead of staying at 12) (http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=990.0;attach=4392;image) thanks! i also noticed if the user drag the hour hand pass the 12 mark left and right a few times the time appears to have another bug as the time change from 11.59 AM to 12.01 PM and turn back, it should be 11.59AM but the bug remains it at 11.59 PM. do you notice that too :) for ur info i look forward to any bug fixes :D Title: Re: A real time clock created with EJS4 Post by: lookang on August 29, 2016, 05:11:02 pm dear prof hwang,
i found a bug when time is say time is HR : MM : SS when MM =59 and SS = 59 clock is suppose to be HR = HR +1 when SS becomes 60 in the next time step dt. but instead the HR jumps back to HR causing the clock to be trap in a infinite loop of HR. attached is my ejss source and model files can you fix the bug on your ejs (so i can examine your solution) or my ejss(so i can continue building it)? thanks! Title: Re: A real time clock created with EJS4 Post by: Fu-Kwun Hwang on August 31, 2016, 11:26:53 am Please check out the following
Title: Re: A real time clock created with EJS4 Post by: lookang on September 01, 2016, 02:49:42 pm i have created this, thank you for being a great mentor Prof Hwang!
http://iwant2study.org/ospsg/index.php/interactive-resources/mathematics/measurement-and-geometry/measurement/2-time/425-clock24wee01 <iframe width="100%" height="750" src="http://iwant2study.org/lookangejss/01_measurement/ejss_model_clockgeogebrawee/clockgeogebrawee_Simulation.xhtml" frameborder="0"> |