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

Information about this web site => Request for physics Simulations => Topic started by: juro41 on November 26, 2011, 08:46:09 pm



Title: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: juro41 on November 26, 2011, 08:46:09 pm
Pleas help me with this simulation. http://zamestnanci.fai.utb.cz/~schauer/contents/mechanics/rotations/ex10_4.htmlHow make this simulation. I never worked with ejs. Thanks.http://zamestnanci.fai.utb.cz/~schauer/contents/mechanics/rotations/ex10_4.html


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: Fu-Kwun Hwang on November 27, 2011, 07:26:31 am
How can I help? What kind of help you need?


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: nobody_12 on November 27, 2011, 07:13:41 pm
to sis vybral pekne tezky applet  :)


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: juro41 on November 28, 2011, 10:28:06 pm
How can I help? What kind of help you need?


Which physics formula use? And how with him manipulate objects?


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: Fu-Kwun Hwang on November 28, 2011, 11:36:17 pm
Do you know how to calculate the net torque $\vec{\tau}$?
Then use $\vec{\tau}=I \vec{\alpha}$ to calculate the angular acceleration $\vec{\alpha}$!


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: juro41 on November 29, 2011, 03:49:42 am
pleas write me whole source code ... thanks


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: Fu-Kwun Hwang on November 29, 2011, 07:37:42 am
The simulation at http://zamestnanci.fai.utb.cz/~schauer/contents/mechanics/rotations/ex10_4.html was created with javascript calling physlet library. The source code for the physlet script is the following:
Code:
var timerID=0;
var loaded=false;

function initApplets(){
clearTimeout(timerID);
        loaded=true;
timerID=setTimeout("initApplet()",100);
}
 
function initApplet(){
      if(!loaded) return;
       timerID=0;
document.Massform.reset();

a=0;
alpha=0;
  document.Animator.setAutoRefresh(false);
  document.Animator.setDefault();
  document.Animator.setTimeDisplay(false);
  document.Animator.shiftPixOrigin(130,130);
  document.Animator.addObject("circle","r=20,x=0,y=0");
  id1=document.Animator.addObject("circle","r=19,x=0,y=0");
  document.Animator.setRGB(id1,255,0,0);
  document.Animator.addLine("2*cos("+alpha+"*0.5*0)","2*sin("+alpha+"*0.5*0)","0","0");
  idb=document.Animator.addObject("image","file=images/dpull.gif,x=0,y=0");
  document.Animator.setTrajectory(idb,"1.5","-14");
  document.Animator.addLine("0","-15-0.5*"+a+"*0","2","0");
  idc=document.Animator.addObject("image","file=images/lpull.gif,x=0,y=0");
  document.Animator.setTrajectory(idc,"-17","2.5");
  document.Animator.addLine("-15-0.5*"+a+"*t^2","0","0","2");
   document.Animator.addObject("circle","r=1,x=0,y=0");
idt=document.Animator.addObject("text","text=omega = ,calc="+alpha+"*t");
document.Animator.setDisplayOffset(idt,-130,-50);
document.Animator.setAnimationSlave(id1,idt);

  forcetext2=document.Animator.addObject("text","text=F");
document.Animator.setDisplayOffset(forcetext2,-20,-30);
forcetext2b=document.Animator.addObject("text","text=2");
document.Animator.setDisplayOffset(forcetext2b,-13,-35);
document.Animator.setAnimationSlave(idb,forcetext2);
document.Animator.setAnimationSlave(idb,forcetext2b);

forcetext1=document.Animator.addObject("text","text=F");
document.Animator.setDisplayOffset(forcetext1,0,-30);
forcetext1b=document.Animator.addObject("text","text=1");
document.Animator.setDisplayOffset(forcetext1b,7,-35);
document.Animator.setAnimationSlave(idc,forcetext1);
document.Animator.setAnimationSlave(idc,forcetext1b);


  document.Animator.addObject("circle","r=20,x=-18,y=-18");
  id1=document.Animator.addObject("circle","r=19,x=-18,y=-18");
  document.Animator.setRGB(id1,255,155,155);
  document.Animator.addObject("circle","r=2,x=-18,y=-18");
  document.Animator.addObject("arrow2","h=-10,v=0,x=-18,y=-16,thickness=2");
  document.Animator.addObject("arrow2","h=0,v=-5,x=-16,y=-18,thickness=2");
  document.Animator.addObject("arrow2","h=10,v=5,x=-18,y=-18,thickness=2");


 document.Animator.setAutoRefresh(true);
}


function cfn11_1(){
    if(!loaded) return;
    f1=document.Massform.force1.value;
       if( !checkRange(f1,0,10)){
     alert("F1 must be between 0 N and 10 N. Your value is "+f1+" N.");
     return;
  }
 
      f2=document.Massform.force2.value;
       if( !checkRange(f2,0,10)){
     alert("F2 must be between 0 N and 10 N. Your value is "+f2+" N.");
     return;
  }
 
       mass=document.Massform.mass.value;
       if( !checkRange(mass,0.1,4)){
     alert("The mass of the pulley must be between 0.1 kg and 4 kg. Your value is "+rad+" kg.");
     return;
  }
  rad=document.Massform.radius.value;
       if( !checkRange(rad,0.5,4)){
     alert("The radius of the pulley must be between 0.5 m and 4 m. Your value is "+rad+" m.");
     return;
  }
 
force1=eval(document.Massform.force1.value);
    force2=eval(document.Massform.force2.value);
    pulleymass=eval(document.Massform.mass.value);
    are=eval(document.Massform.radius.value);
hand1=eval(are-0.5);
hand2=eval(are+0.5);
    vector1=eval(are-18);
vector2=eval(-18+are);

arem=eval(are-0.1);
radius=eval(are*10);
mradius=eval(-are);
radiusm=eval(are*10-1);

a=eval(2*(force1-force2)/(pulleymass));
alpha=eval(a/are);
  document.Animator.setAutoRefresh(false);

  document.Animator.setDefault();
  document.Animator.shiftPixOrigin(130,130);
  document.Animator.setTimeDisplay(false);
  document.Animator.addObject("text","text=Time:  ,calc=t,x=-26,y=-26");

document.Animator.addObject("circle","r="+radius+",x=0,y=0");

  id1=document.Animator.addObject("circle","r="+radiusm+",x=0,y=0");
  document.Animator.setRGB(id1,255,0,0);
  document.Animator.addObject("circle","r=1,x=0,y=0");
  document.Animator.addLine("cos("+alpha+"*0.5*t*t)*"+arem,"sin("+alpha+"*0.5*t*t)*"+arem,"0","0");
  idb=document.Animator.addObject("image","file=images/dpull.gif,x=0,y=0");
  document.Animator.setTrajectory(idb,hand1,"-14+0.5*"+a+"*t^2");
  document.Animator.setSticky(idb,true);
  document.Animator.addLine("0","-15+0.5*"+a+"*t*t",are,"0");
  idc=document.Animator.addObject("image","file=images/lpull.gif,x=0,y=0");
  document.Animator.setTrajectory(idc,"-17-0.5*"+a+"*t^2",hand2);
  document.Animator.setSticky(idc,true);
  document.Animator.addLine("-15-0.5*"+a+"*t^2","0","0",are);
rid1=document.Animator.addObject("rectangle","h=20,w=20,x=-30,y=0");
rid2=document.Animator.addObject("rectangle","h=20,w=20,x=-30,y=0");
document.Animator.setForce(rid1,"0","0",-30,are,0,0);
  document.Animator.setForce(rid2,"0","0",are,-30,0,0);
document.Animator.setSticky(rid1,true);
document.Animator.setSticky(rid2,true);
document.Animator.setVisibility(rid1,false);
document.Animator.setVisibility(rid2,false);
document.Animator.setCollisionMessage("End of Animation");
document.Animator.setOneShot(0,5,"End of Animation");
idt=document.Animator.addObject("text","text=omega = ,calc="+alpha+"*t");
document.Animator.setDisplayOffset(idt,-130,-50);
document.Animator.setAnimationSlave(id1,idt);
 
 
  forcetext2=document.Animator.addObject("text","text=F");
document.Animator.setDisplayOffset(forcetext2,-20,-30);
forcetext2b=document.Animator.addObject("text","text=2");
document.Animator.setDisplayOffset(forcetext2b,-13,-35);
document.Animator.setAnimationSlave(idb,forcetext2);
document.Animator.setAnimationSlave(idb,forcetext2b);

forcetext1=document.Animator.addObject("text","text=F");
document.Animator.setDisplayOffset(forcetext1,0,-30);
forcetext1b=document.Animator.addObject("text","text=1");
document.Animator.setDisplayOffset(forcetext1b,7,-35);
document.Animator.setAnimationSlave(idc,forcetext1);
document.Animator.setAnimationSlave(idc,forcetext1b);

document.Animator.addObject("circle","r="+radius+",x=-18,y=-18");
  id1=document.Animator.addObject("circle","r="+radiusm+",x=-18,y=-18");
  document.Animator.setRGB(id1,255,155,155);
  document.Animator.addObject("circle","r=2,x=-18,y=-18");
  document.Animator.addObject("arrow2","h=-"+force1+",v=0,x=-18,y="+vector1+",thickness=2");
  document.Animator.addObject("arrow2","h=0,v=-"+force2+",x="+vector2+",y=-18,thickness=2");
  document.Animator.addObject("arrow2","h="+force1+",v="+force2+",x=-18,y=-18,thickness=2");
document.Animator.setAutoRefresh(true);
  document.Animator.forward();
}

function killmenow(){
window.onerror= function() { return true;}
clearTimeout(timerID);
loaded=false;
timerID=-1;
}



Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: juro41 on November 30, 2011, 04:13:11 pm
it is possible to convert this source code to java code?


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: ahmedelshfie on November 30, 2011, 07:57:08 pm
I believe you can convert any java code to java class, however you need to download program to compile i suggest DJ Java Decompiler, remember you should download java J2se sdk too.

You can download DJ Java Decompiler from here http://members.fortunecity.com/neshkov/dj.html  (http://members.fortunecity.com/neshkov/dj.html)


Title: Re: Torque on Pulley Due to the Tension of Two Strings/board:26-101-
Post by: juro41 on December 08, 2011, 11:39:05 pm
pleas if is possible send me .jar file. thanks