This is the web version of EJS interface
EJS version 4.3.3
1. Title=Direct Current Electrical Motor Model
2. Author=Fu-Kwun Hwang - Dept. of Physics, National Taiwan Normal Univ. & lookang
3. Keywords=Direct Current Electrical Motor Model
4. Level=High School, Pre University
5. Abstract=hwang@phy.ntnu.edu.tw remixed by lookang
6. CaptureTools=false
7. DataTools=true
8. LanguageTools=false
9. EmersionSupport=false
10. UseInterpreter=true
11. DetectedFiles=./DCmotor/DCmotor/DCmotor.PNG;
12. AuxiliaryFiles=./DCmotor/;./DCmotor/DCmotor.html;

## DCmotor

NameValueTypeDimension
NameValueTypeDimension
NameValueTypeDimension
NameValueTypeDimension
NameValueTypeDimension
NameValueTypeDimension
NameValueTypeDimension

### Init Page

for(int i=0;i<n;i++){ // y1[i]=-b+D*i; // older model by hwang // y3[i]=b-D*i; // x2[i]=a-D*i; // x4[i]=-a+D*i; // new model by lookang to add variable of length of coil y1[i]=-lengthz/2+lengthz/n*i; // AD y3[i]=lengthz/2-lengthz/n*i; // BC x2[i]=a-lengthx/n*i; //AB x4[i]=a-lengthx/n*i; // DC } for(int i=0;i<4;i++){ x5s[i]=a+8*R-i*D; x6s[i]=a+i*D; } setparam (); //

### Evol Page

 Indep. Var. Increment d cta /dt= omega d omega /dt= (getAlpha(cta) -bf*omega)/Inertia d y1[i] /dt= e*vy1*sign*3 d y3[i] /dt= e*vy3*sign*3 d x2[i] /dt= e*vx2*sign*3 d x4[i] /dt= e*vx4*sign*3 d x5s[i] /dt= -e*v0*sign*3 d x6s[i] /dt= e*v0*sign*3 d z7s[i] /dt= e*vz7*sign3/10 d y8s[i] /dt= -e*vy8*sign3/10 d y9s[i] /dt= e*vy8*sign3/10 Solver MidPoint Tolerance=0.001
//if(_isPlaying()){ cs=Math.cos(cta); sc=Math.sin(cta); // define mathematical eqn vb[1]=2*b*sc; // define direction of coil vb[1]= 2*b*sc; vb[2]=2*b*cs; // define direction of coil vb[2]= 2*b*cs; y2s=lengthz/2*sc; // control position of particles AB z2s=lengthz/2*cs; // control position of particles AB y4s=-lengthz/2*sc; // control position of particles DC z4s=-lengthz/2*cs; // control position of particles DC // y2s=y2*sc; // z2s=y2*cs; // y4s=y4*sc; // z4s=y4*cs; for(int i=0;i<n;i++){ // position of current particles on AD if(y1[i]<(lengthz/2)-(lengthz/n)*(i+1))y1[i]+=(lengthz/n); else if(y1[i]>(lengthz/2)-(lengthz/n)*i)y1[i]-=(lengthz/n); // position of current particles on DC if(y3[i]<(lengthz/2)-(lengthz/n)*(i+1))y3[i]+=(lengthz/n); else if(y3[i]>(lengthz/2)-(lengthz/n)*i)y3[i]-=(lengthz/n); // position of current particles on AB // the logic is //if(x2[i]<start-(equaldistance)*(i+1))x2[i]+=equaldistance; // else if(x2[i]>start-(equaldistance)*i)x2[i]-=equaldistance; //s_m2[i] =double2String(i,1); // for debugging purposes the text on the 3D view if(x2[i]<a-(lengthx/n)*(i+1))x2[i]+=lengthx/n; else if(x2[i]>a-(lengthx/n)*i)x2[i]-=lengthx/n; // position of current particles on DC if(x4[i]<a-(lengthx/n)*(i+1))x4[i]+=lengthx/n; else if(x4[i]>a-(lengthx/n)*i)x4[i]-=lengthx/n; //if(x4[i]>-a+(lengthx/n)*(i+1))x4[i]-=(lengthx/n); // else if(x4[i]<-a+(lengthx/n)*i)x4[i]+=(lengthx/n); y1s[i]=y1[i]*sc; z1s[i]=y1[i]*cs; // position of current particles on BC x3s=a-lengthx; // added to control particles on BC controllable by lengthx y3s[i]=y3[i]*sc; z3s[i]=y3[i]*cs; if((y1[i]-R)*(y1[i]+R)<0)s1[i]=false; else s1[i]=true; // help added by lookang // z7s[i] change to xyz10s[i] > - Pos xyz + (i+1)*(sizexyz)/i xyz[i] = xyz[i] - sizexyz/i; // battery wire } /* for(int i=0;i<n;i++){ if(y1[i]>-b+D*(i+1))y1[i]-=D; else if(y1[i]<-b+D*i)y1[i]+=D; if(y3[i]<b-D*(i+1))y3[i]+=D; else if(y3[i]>b-D*i)y3[i]-=D; if(x2[i]<a-D*(i+1))x2[i]+=D; else if(x2[i]>a-D*i)x2[i]-=D; if(x4[i]>-a+D*(i+1))x4[i]-=D; else if(x4[i]<-a+D*i)x4[i]+=D; y1s[i]=y1[i]*sc; z1s[i]=y1[i]*cs; y3s[i]=y3[i]*sc; z3s[i]=y3[i]*cs; if((y1[i]-R)*(y1[i]+R)<0)s1[i]=false; else s1[i]=true; } */ for(int i=0;i<4;i++){ // top 0 degree connecting wire from brush to coil if(x5s[i]<a+8*R-(i+1)*D)x5s[i]+=D; else if(x5s[i]>a+8*R-i*D)x5s[i]-=D; // bottom 180 degree connecting wire from brush to coil if(x6s[i]>a+(i+1)*D)x6s[i]-=D; else if(x6s[i]<a+i*D)x6s[i]+=D; // battery top wire particles spacing //disable move to a imax = 2 loop to create lesser particles if(z7s[i]>-R*1.15+(i+1)*2.25*R/4)z7s[i]-=2.25*R/4; // by trial n error to achieve range from ehich particle appear n disappear else if(z7s[i]<-R*1.15+i*2.25*R/4)z7s[i]+=2.25*R/4; //if(z7s[i]>0-(i+1)*2.25*R/5)z7s[i]-=D; // by trial n error to achieve look of particles // else if(z7s[i]<0-i*2.25*R/5)z7s[i]+=D; // top battery wire if(y8s[i]>-0-R*2+(i+1)*(R*2)/4)y8s[i]-=R*2/4; // by trial n error to achieve look of particles else if(y8s[i]<-0-R*2+i*(R*2)/4)y8s[i]+=R*2/4; // bottom battery wire if(y9s[i]>-0-R*2+(i+1)*(R*2)/4)y9s[i]-=R*2/4; // by trial n error to achieve look of particles else if(y9s[i]<-0-R*2+i*(R*2)/4)y9s[i]+=R*2/4; } // to modify this particle distribution and appear/disappear // help added by lookang // z7s[i] change to xyz10s[i] > - Pos xyz + (i+1)*(sizexyz)/i xyz[i] = xyz[i] - sizexyz/i; // battery wire //}
F= a2*sign2*Inertia/b; force = N*I*L*B; torque = getAlpha(cta); //F*R*cs*4*2; // a2*sign2*R*cs*4*2
ctatheory = ctadegree0360+90; // created by lookang for slider ctadegree0360 ctadegree = Math.atan2(sc,cs)*180/(pi); // if ( ctadegree<0 ) { if ( ctadegree<-90 ) { ctadegree0360 = ctadegree +360; } else { ctadegree0360 =ctadegree; } //created by lookang for comparison to get getAlpha(cta) -bf*omega to model contact previously missing cta02pi = Math.atan2(sc,cs); // omega omegadegree = omega*180/(pi); // split ring cta1 cta2 //cta1degree = cta1*180/(pi); //cta2degree = cta2*180/(pi); // for split ring cta1degree=cta2degree cta1degree=-cta2degree; // sliders display to work cta1 = cta1degree*pi/180; cta2 = cta2degree*pi/180;
public void setparam () { L=lengthx; b=lengthz; a2=N*I*L*B*b*1; // // a2 is the torque*length b // from F.b = inertia.ctadoubledot // N*IBL.b = inertia.ctadoubledot // suspect a2 = ctadoubledot // a2*sign2 v0=4*size*I; vy1=vx4=v0; vx2=-v0; vy3=-v0; BZ0=-(zmin+(B+2)*range/4); }
public double getAlpha (double cta) { //sign4 = 1; // for the particles on the battery wires direction of motion sign3 = sign4; //sign3 =sign; // sign3 stored sign for particle in battery wires //if(!Is)sign=-sign; // boolean Is current state is not 0, sign =-sign //if(!Is)sign3=-sign3; // make sign3 flip if electron is selected if (I>0){ sign4 = 1; // battery wire constant direction } else { sign4 = -1; // battery wire constant negative direction } if (splitring==true){ if(Math.cos(cta)>=0&&cta02pi<=cta2&&cta02pi<=pi/2&&cta02pi>=0) { //contact test = 1; sign=1; // 1stQ sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 //if(!Is)sign=-sign; // the position of the code is clever to make electron opposite return a2*Math.abs(Math.cos(cta)); } else if (Math.cos(cta)<=0&&cta02pi>=pi-cta2&&cta02pi>=pi/2&&cta02pi<=pi) { test = 2; sign=-1; //2ndQ sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 //if(!Is)sign=-sign; //sign4 = 1; return a2*Math.abs(Math.cos(cta)); } else if(Math.cos(cta)<=0&&cta02pi<=-pi-cta1&&cta02pi>=-pi&&cta02pi<=-pi/2) { test =3; sign=-1; // 3rdQ sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 // if(!Is)sign=-sign; //sign4 = 1; return a2*Math.abs(Math.cos(cta)); } else if (Math.cos(cta)>=0&&cta02pi>=cta1&&cta02pi>=-pi/2&&cta02pi<=0) { test= 4; sign=1; //4thQ sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 //sign4 = 1; // if(!Is)sign=-sign; return a2*Math.abs(Math.cos(cta)); } else { test= 0; sign = 0; // no contact no magnetic force sign2=0; // show no force sign4 = 0; return 0; } } else { //sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 test = 5; sign = 1; // need this to fix bug for spilt ring force point wrong direction sign2=1; // need this to fix bug of force not showing toggleing from splitring to not return a2*(Math.cos(cta)); // for no split ring } }
EJSVIEW: Click link to view it's content
 Control variables:(testing)double,double,double,double,double,double,double,double,double,double,double,double
 title = "Direct Current Electrical Motor Model" layout = border visible = true location = "171,81" size = "750,600"
 position = center minimumX = xmin maximumX = xmax minimumY = ymin maximumY = ymax minimumZ = zmin maximumZ = zmax cameraAzimuth = -6.439999999999994 cameraAltitude = 0.09031596330733228 cameraFocusX = 0.0 cameraFocusY = 0.0 cameraFocusZ = 0.0 cameraRotation = 0.0 cameraDistanceToScreen = 5.93999999999998 implementation = mode background = 200,220,208
 visible = label==true
 x = a y = R*sc*4 z = R*cs*4 text = "A" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = -a y = R*sc*4 z = R*cs*4 text = "B" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = -a y = -R*sc*4 z = -R*cs*4 text = "C" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = a y = -R*sc*4 z = -R*cs*4 text = "D" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = 6*R y = 0 z = 0 sizeX = -D*6 sizeY = 0 sizeZ = 0 lineColor = WHITE
 x = 6*R y = 0 z = 0 text = "P" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = -6*R y = 0 z = 0 text = "Q" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = a+8*R y = R*sc z = R*cs text = "X" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = a+8*R y = -R*sc z = -R*cs text = "Y" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 x = 8*R+a y = -R*2.8 z = R/2 text = "Battery" font = Arial Narrow,BOLD,16 elementposition = SOUTH lineColor = RED fillColor = RED
 x = a+8*R y = 0 z = 0 text = "Split Ring" font = Arial Narrow,BOLD,16 elementposition = SOUTH lineColor = CYAN fillColor = CYAN
 x = a+8*R y = 0 z = R*1.35 text = "Top Brush" font = Arial Narrow,BOLD,16 elementposition = SOUTH lineColor = BLACK fillColor = BLACK
 x = a+8*R y = 0 z = -R*1.45 text = "Bottom Brush" font = Arial Narrow,BOLD,16 elementposition = NORTH lineColor = BLACK fillColor = BLACK
 x = a y = (1.1*R)*sc+sc*lengthz/2-R*sc z = (1.1*R)*cs+cs*lengthz/2-R*cs text = "Coil" font = Arial Narrow,BOLD,16 elementposition = NORTH_EAST lineColor = DARKGRAY fillColor = DARKGRAY
 x = a y = R*sc*4 z = R*cs*4 text = "*" font = Arial,BOLD,32 lineColor = WHITE fillColor = WHITE
 firstDirection = va secondDirection = vb visible = false lineColor = DARKGRAY fillColor = null lineWidth = stroke*3
 x = a y = -R*sc z = -R*cs sizeX = 0 sizeY = R*sc*2*0.9 sizeZ = R*cs*2*0.9 visible = false lineColor = 200,220,208 lineWidth = stroke*3.1*N
 x = a y = R*sc z = R*cs sizeX = 8*R sizeY = 0 sizeZ = 0 lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a y = -R*sc z = -R*cs sizeX = 8*R sizeY = 0 sizeZ = 0 lineColor = DARKGRAY lineWidth = stroke*3*N
 x = 0 y = 0 z = 0
 x = a y = R*sc z = R*cs sizeX = 0 sizeY = sc*lengthz/2-R*sc sizeZ = cs*lengthz/2-R*cs lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a y = (R)*sc+sc*lengthz/2-R*sc z = (R)*cs+cs*lengthz/2-R*cs sizeX = -lengthx sizeY = 0 sizeZ = 0 lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a y = -R*sc z = -R*cs sizeX = 0 sizeY = -(sc*lengthz/2-R*sc) sizeZ = -(cs*lengthz/2-R*cs) lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a y = -R*sc+-(sc*lengthz/2-R*sc) z = -R*cs+-(cs*lengthz/2-R*cs) sizeX = -lengthx sizeY = 0 sizeZ = 0 lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a-lengthx y = 0 z = 0 sizeX = 0 sizeY = sc*lengthz/2 sizeZ = cs*lengthz/2 lineColor = DARKGRAY lineWidth = stroke*3*N
 x = a-lengthx y = 0 z = 0 sizeX = 0 sizeY = -(sc*lengthz/2) sizeZ = -(cs*lengthz/2) lineColor = DARKGRAY lineWidth = stroke*3*N
 points = 17 min = cta1 max = cta2 variable = "c" functionx = "a+8*R" functiony = "R*sin(c+cta)" functionz = "R*cos(c+cta)" javaSyntax = false visible = splitring lineColor = 0,255,255 lineWidth = stroke*5
 points = 17 min = cta1 max = cta2 variable = "c" functionx = "a+8*R" functiony = "R*sin(c+cta+pi)" functionz = "R*cos(c+cta+pi)" javaSyntax = false visible = splitring==true lineColor = CYAN lineWidth = stroke*5
 x = 8*R+a y = 0 z = R*1.15 sizeX = R/4 sizeY = R/4 sizeZ = R/4 fillColor = BLACK
 x = 8*R+a y = 0 z = -R*1.15 sizeX = R/4 sizeY = R/4 sizeZ = R/4 fillColor = BLACK
 x = a+8*R y = 0 z = R sizeX = a+8*R-(a+8*R) sizeY = sc*R sizeZ = cs*R-R visible = splitring==false radius = R/10 lineColor = DARKGRAY lineWidth = stroke*2
 x = a+8*R y = 0 z = -R sizeX = a+8*R-(a+8*R) sizeY = -sc*R sizeZ = -cs*R+R visible = splitring==false radius = R/10 lineColor = DARKGRAY lineWidth = stroke*2
 points = 17 min = 0 max = cta variable = "cta" functionx = "a+8*R" functiony = "R*sin(cta)" functionz = "R*cos(cta)" javaSyntax = false visible = false lineColor = BLACK lineWidth = stroke*5
 points = 17 min = pi max = cta+pi variable = "cta" functionx = "a+8*R" functiony = "R*sin(cta)" functionz = "R*cos(cta)" javaSyntax = false visible = false lineColor = BLACK lineWidth = stroke*5
 x = a+8*R y = 0 z = R sizeX = a+8*R-(a+8*R) sizeY = sc*R sizeZ = cs*R-R visible = splitring==false elementposition = SOUTH_WEST lineColor = BLACK fillColor = BLACK lineWidth = stroke*3
 x = a+8*R y = 0 z = -R sizeX = a+8*R-(a+8*R) sizeY = -sc*R sizeZ = -cs*R+R visible = splitring==false elementposition = SOUTH_WEST lineColor = BLACK fillColor = BLACK lineWidth = stroke*3
 x = 8*R+a y = 0 z = R*1.15 sizeX = 0 sizeY = -R*2 sizeZ = 0 lineWidth = stroke*1.5
 x = 8*R+a y = 0 z = -R*1.15 sizeX = 0 sizeY = -R*2 sizeZ = 0 lineWidth = stroke*1.5
 x = 8*R+a y = -R*2 z = R*1.15 sizeX = 0 sizeY = 0 sizeZ = -R lineWidth = stroke*1.5
 x = 8*R+a y = -R*2 z = -R*1.15 sizeX = 0 sizeY = 0 sizeZ = R lineWidth = stroke*1.5
 visible = I>0
 x = 8*R+a y = -R*2 z = R/2 sizeX = R/4 sizeY = R/4 sizeZ = R/4 fillColor = RED
 x = 8*R+a y = -R*2 sizeX = R/2 sizeY = R/2 sizeZ = R fillColor = DARKGRAY
 x = 8*R+a y = -R*2.5 z = R/2 sizeX = R sizeY = R sizeZ = R text = "+" font = Arial,PLAIN,20 lineColor = RED fillColor = RED
 visible = I<0
 x = 8*R+a y = -R*2 z = -R/2 sizeX = R/4 sizeY = R/4 sizeZ = R/4 fillColor = RED
 x = 8*R+a y = -R*2 sizeX = R/2 sizeY = R/2 sizeZ = R fillColor = DARKGRAY
 x = 8*R+a y = -R*2.5 z = -R/2 sizeX = R sizeY = R sizeZ = R text = "+" font = Arial,PLAIN,20 lineColor = RED fillColor = RED
 numberOfElements = 4 x = 8*R+a y = -R*2 z = z7s sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = 4 x = 8*R+a y = y8s z = R*1.15 sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = 4 x = 8*R+a y = y9s z = -R*1.15 sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = n x = x1s y = y1s z = z1s sizeX = size sizeY = size sizeZ = size visible = s1 lineColor = clr fillColor = clr2
 numberOfElements = n x = x2 y = y2s z = z2s sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = n x = x3s y = y3s z = z3s sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = n x = x4 y = y4s z = z4s sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = 4 x = x5s y = R*sc z = R*cs sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = 4 x = x6s y = -R*sc z = -R*cs sizeX = size sizeY = size sizeZ = size lineColor = clr fillColor = clr2
 numberOfElements = n x = x2 y = y2s z = z2s sizeX = 0 sizeY = a2*sign2 sizeZ = 0 visible = showF lineColor = 0,192,0 fillColor = 0,192,0
 numberOfElements = n x = x4 y = y4s z = z4s sizeX = 0 sizeY = -a2*sign2 sizeZ = 0 visible = showF lineColor = 0,192,0 fillColor = 0,192,0
 numberOfElements = 4 x = x6s y = -R*sc z = -R*cs sizeX = 0 sizeY = -a2*sign2 sizeZ = 0 visible = false lineColor = DARKGRAY fillColor = DARKGRAY
 numberOfElements = 4 x = x5s y = R*sc z = R*cs sizeX = 0 sizeY = a2*sign2 sizeZ = 0 visible = false lineColor = DARKGRAY fillColor = DARKGRAY
 numberOfElements = n x = x1 y = y1s z = z1s sizeX = 0 sizeY = vy1*sign*sc sizeZ = vy1*sign*cs visible = false lineColor = MAGENTA fillColor = MAGENTA
 numberOfElements = n x = x2 y = y2s z = z2s sizeX = e*vx2*sign*3 sizeY = 0 sizeZ = 0 visible = showV lineColor = MAGENTA fillColor = MAGENTA
 numberOfElements = n x = x3 y = y3s z = z3s sizeX = 0 sizeY = vy3*sign*sc sizeZ = vy3*sign*cs visible = false lineColor = MAGENTA fillColor = MAGENTA
 numberOfElements = n x = x4 y = y4s z = z4s sizeX = e*vx4*sign*3 sizeY = 0 sizeZ = 0 visible = showV lineColor = MAGENTA fillColor = MAGENTA
 minimumX = xmin maximumX = xmax minimumY = ymin maximumY = ymax minimumZ = BZ0 maximumZ = -BZ0 xcomponent = bfx ycomponent = bfy zcomponent = bfz length = xmax*B visible = showBF elementposition = CENTERED mincolor = ORANGE maxcolor = ORANGE
 z = zmax*1.5 text = %l_current% lineWidth = stroke
 visible = showBFmagnet
 x = 0 y = 0 z = (zmin-zmax)/2 sizeX = xmax-xmin sizeY = ymax-ymin sizeZ = (zmax-zmin)/8 visible = B>0 lineColor = GRAY fillColor = 255,0,0,100 resolution = "1,1,1"
 x = 0 y = 0 z = (zmin-zmax)/1.8 visible = B>0 text = "N" font = Monospaced,BOLD,30 lineColor = BLACK fillColor = BLACK
 x = 0 y = 0 z = -(zmin-zmax)/2 sizeX = xmax-xmin sizeY = ymax-ymin sizeZ = (zmax-zmin)/8 visible = B>0 lineColor = GRAY fillColor = 0,0,255,100 resolution = "1,1,1"
 x = 0 y = 0 z = -(zmin-zmax)/1.8 visible = B>0 text = "S" font = Monospaced,BOLD,30 lineColor = BLACK fillColor = BLACK
 visible = showBFmagnet
 x = 0 y = 0 z = -(zmin-zmax)/2 sizeX = xmax-xmin sizeY = ymax-ymin sizeZ = (zmax-zmin)/8 visible = B<0 lineColor = GRAY fillColor = 255,0,0,100 resolution = "1,1,1"
 x = 0 y = 0 z = -(zmin-zmax)/1.8 visible = B<0 text = "N" font = Monospaced,BOLD,30 lineColor = BLACK fillColor = BLACK
 x = 0 y = 0 z = (zmin-zmax)/2 sizeX = xmax-xmin sizeY = ymax-ymin sizeZ = (zmax-zmin)/8 visible = B<0 lineColor = GRAY fillColor = 0,0,255,100 resolution = "1,1,1"
 x = 0 y = 0 z = (zmin-zmax)/1.8 visible = B<0 text = "S" font = Monospaced,BOLD,30 lineColor = BLACK fillColor = BLACK
 position = south layout = GRID:0,1,0,0
 layout = HBOX
 layout = VBOX
 layout = hbox
 text = " $\\theta$ = " background = 0,192,255 tooltip = "angular displacement of armature"
 variable = ctatheory format = "000" action = cta = (ctatheory-90)*pi/180; omega = 0; // reset omega to zero tooltip = "angular displacement of armature"
 text = " deg " background = 0,192,255
 variable = ctatheory value = 0 minimum = 0 maximum = 360 ticks = 13 closest = true enabled = true dragaction = cta = (ctatheory-90)*pi/180; omega = 0; // reset omega to zero background = 0,192,255 tooltip = "angular displacement of armature"
 layout = VBOX
 layout = hbox
 text = " $\\omega$ = " background = 200,0,200,255 tooltip = "angular velocity of armature"
 variable = omegadegree format = "000" editable = false action = cta = (ctatheory-90)*pi/180; omega = 0; // reset omega to zero tooltip = "angular displacement of armature"
 text = " deg/s " background = 200,0,200,255
 variable = omegadegree minimum = -360 maximum = 360 enabled = false background = 200,0,200,255 tooltip = "angular velocity of armature"
 layout = VBOX
 layout = hbox
 text = " $\\alpha$ = " background = 200,0,0,255 tooltip = "angular acceleration of armature"
 variable = (getAlpha(cta) -bf*omega)*180/pi format = "000" editable = false tooltip = "angular displacement of armature"
 text = " deg/(s*s) " background = 200,0,0,255
 variable = (getAlpha(cta) -bf*omega)*180/pi minimum = -50 maximum = 50 enabled = false background = 200,0,0,255 tooltip = "angular acceleration of armature"
 position = center layout = GRID:1,0,0,0
 layout = HBOX background = 0,192,0
 variable = showF mnemonic = "f" background = 0,192,0 tooltip = "To visualize Fy magnetic = I*B*L*sin(I&B)"
 variable = F minimum = -2 maximum = 2 format = "FBy = 0.0 N" enabled = false background = 0,192,0 tooltip = "Fy magnetic = N*I*B*L*sin(I&B)"
 variable = torque minimum = -2 maximum = 2 format = "TB = 0.0 N m" enabled = false background = 0,50,0 foreground = WHITE tooltip = " magnetic Torque = I*B*L*sin(I&B)*AD*cos(cta), clockwise positive"
 layout = HBOX
 layout = VBOX
 layout = hbox
 text = " $\\beta$2 = " background = 0,192,255 tooltip = "split ring commutator angle for contact in degree"
 variable = cta2degree format = "0.0" action = _initialize() tooltip = "split ring commutator angle for contact in degree"
 text = " deg " background = 0,192,255
 variable = cta2degree value = 80 minimum = 0.0 maximum = 80 ticks = 9 closest = true dragaction = _initialize() background = 0,192,255 tooltip = "split ring commutator angle for contact in degree"
 layout = VBOX
 layout = hbox
 text = " I = " background = YELLOW font = Times New Roman,BOLD,16 tooltip = "current in the circuit suppied by the battery"
 variable = I format = "0.0" action = setparam () tooltip = "current in the circuit suppied by the battery"
 text = " A " background = YELLOW
 variable = I minimum = -2 maximum = 2.0 ticks = 11 closest = true dragaction = setparam () background = YELLOW tooltip = "current in the circuit suppied by the battery"
 layout = HBOX
 layout = VBOX
 position = center variable = showBF mnemonic = "b" background = ORANGE tooltip = "To visualize the external magnetic field from the NS magnets in the z direction"
 position = north variable = showBFmagnet mnemonic = "s" background = RED tooltip = "NS magnets"
 layout = VBOX
 layout = hbox
 text = " Bz = " background = ORANGE tooltip = "External magnetic field from the NS magnets in the z direction"
 variable = B format = "0.0" action = setparam () tooltip = "External magnetic field from the NS magnets in the z direction"
 text = " T " background = ORANGE
 variable = B value = 0.7999999999999998 minimum = -2.0 maximum = 2.0 ticks = 11 closest = true dragaction = setparam () background = ORANGE tooltip = "External magnetic field from the NS magnets in the z direction"
 layout = VBOX
 layout = hbox
 text = " Lx = " background = DARKGRAY foreground = WHITE tooltip = "length of coil in x direction"
 variable = lengthx format = "0.0" action = _initialize(); setparam (); tooltip = "length of coil in x direction"
 text = " m " background = DARKGRAY foreground = WHITE
 variable = lengthx minimum = 0 maximum = 2*a ticks = 16 closest = true dragaction = _initialize(); setparam (); background = DARKGRAY foreground = WHITE tooltip = "length of coil in x direction"
 layout = VBOX
 layout = hbox
 text = " Lz = " background = DARKGRAY foreground = WHITE tooltip = "length of coil in z direction"
 variable = lengthz format = "0.0" action = _initialize(); setparam (); tooltip = "length of coil in z direction"
 text = " m " background = DARKGRAY foreground = WHITE
 variable = lengthz minimum = R*2 maximum = 2*a ticks = 16 closest = true dragaction = _initialize(); setparam (); background = DARKGRAY tooltip = "length of coil in z direction"
 layout = VBOX
 layout = hbox
 text = " N = " background = DARKGRAY foreground = WHITE tooltip = "numberof turns in the coil N"
 variable = N format = "0.0" action = _initialize(); setparam (); tooltip = "numberof turns in the coil N"
 background = DARKGRAY foreground = WHITE
 variable = N minimum = 1 maximum = 7 ticks = 7 closest = true dragaction = _initialize(); setparam (); background = DARKGRAY foreground = WHITE tooltip = "numberof turns in the coil N"
 layout = VBOX
 layout = hbox
 text = " Inertia =" tooltip = "Inertia of the physical dimensions of the DC motor"
 variable = Inertia format = "0.0" tooltip = "Inertia of the physical dimensions of the DC motor"
 variable = Inertia value = 1.0 minimum = 1.0 maximum = 7.0 ticks = 7 closest = true tooltip = "Inertia of the physical dimensions of the DC motor"
 layout = VBOX
 layout = hbox
 text = " Ff =" background = 0,192,0 tooltip = "friction force based on model F friction = -k.$\\omega$"
 variable = bf format = "- 0.0*$\\omega$" tooltip = "length of coil in z direction"
 text = "N " background = 0,192,0
 variable = bf minimum = 0.0 maximum = 1.0 ticks = 11 closest = true background = 0,192,0 tooltip = "friction force based on model F friction = -k.$\\omega$"
 layout = VBOX visible = false
 selected = true text = "Simple 3D " noUnselect = true actionon = mode = 0;
 variable = true text = "Java 3D " noUnselect = true actionon = mode = 1;
 position = south layout = HBOX borderType = LOWERED_ETCHED
 layout = HBOX
 variable = splitring selected = true text = "splitring?" mnemonic = "s" background = WHITE tooltip = "to select with splitring commutator"
 position = center variable = label selected = true text = "labels?" mnemonic = "l" background = WHITE tooltip = "to see text labels for ease of verbalization"
 variable = Is selected = false text = %l_current% mnemonic = "c" action = if(Is==true){ e=1; // sign2=sign; sign3 =-1; // added by lookang for electron //vy1 = vy1; // for current //vy3 = vy3; //vx2 = vx2; //vx4 = vx4; //vz7 = vz7; //v0 = v0; clr=yellow; clr2=yellow; clabel="+"; l_current="Current flow"; }else{ e=-1; // sign2=sign; sign3=+1; // added by lookang //vy1 = -vy1; // for current //vy3 = -vy3; //vx2 = -vx2; //vx4 = -vx4; //v0 = -v0; //vz7= -vz7; clr=green; clr2=green2; clabel="-"; l_current="Elecron flow"; } background = clr tooltip = "current or electron"
 variable = showV text = "velocity" mnemonic = "v" background = MAGENTA tooltip = "to visualize the velocity of the charged particles"
 variable = showGraph text = "show graph"
 variable = t minimum = 0.0 maximum = 10 format = "t = 0.00 s" tooltip = "time lapse after simulation START"
 position = east layout = HBOX
 variable = _isPaused tooltip = "paly / pause simulation" imageOn = /org/opensourcephysics/resources/controls/images/play.gif actionOn = _play() imageOff = /org/opensourcephysics/resources/controls/images/pause.gif actionOff = _pause()
 image = "/org/opensourcephysics/resources/controls/images/stepforward.gif" action = _step()
 image = /org/opensourcephysics/resources/controls/images/reset.gif action = _reset() tooltip = "reset simulation"
 position = east layout = VBOX visible = showGraph borderTitle = "Data Plot"
 autoscaleX = true autoscaleY = true minimumX = t0 title = "Angle and FBy and TB vs Time" titleX = "time(s)" titleY = "angle(deg) & FBy (10^2*N) and TB (10^2*N.m)" visible = vstime interiorBackground = 200,220,208
 inputX = t inputY = ctatheory visible = ctadegree0360graph norepeat = true lineColor = 0,192,255 lineWidth = 2 xLabel = "time" yLabel = "angle"
 inputX = t inputY = F*100 visible = Fgraph norepeat = true lineColor = 0,192,0 lineWidth = 2 yLabel = "force magentic"
 inputX = t inputY = torque*100 visible = torquegraph norepeat = true lineColor = 0,50,0 lineWidth = 2 yLabel = "torque"
 autoscaleY = true minimumX = 0 maximumX = 360 minimumY = -2 maximumY = 2 title = "Magnetic Force FBy and Magnetic Torque TB vs Angle $\theta$" titleX = "Angle $\theta$ (deg)" titleY = "Magnetic Force FBy(N) & Magnetic Torque TB (N.m)" visible = vsangle interiorBackground = 200,220,208
 inputX = ctatheory inputY = F visible = Fgraph norepeat = true connected = false lineColor = 0,192,0 lineWidth = 2 yLabel = "force"
 x = ctatheory y = F sizeX = 5 sizeY = 5 pixelSize = true visible = Fgraph style = ELLIPSE fillColor = 0,192,255
 x = ctatheory y = F pixelSize = true measured = false enabledPosition = true text = " -Force magnetic" font = Monospaced,BOLD,14 elementposition = WEST lineColor = 0,192,0
 x = ctatheory y = torque pixelSize = true measured = false enabledPosition = true text = " -Torque magnetic" font = Monospaced,BOLD,14 elementposition = WEST lineColor = 0,50,0
 inputX = ctatheory inputY = torque visible = torquegraph norepeat = true connected = false lineColor = 0,50,0 lineWidth = 2 yLabel = "torque"
 x = ctatheory y = torque sizeX = 5 sizeY = 5 pixelSize = true visible = torquegraph style = ELLIPSE fillColor = 0,192,255
 layout = FLOW:center,0,0 borderType = LOWERED_ETCHED
 image = "/org/opensourcephysics/resources/controls/images/erase.gif" action = t0=t; _view.resetTraces() tooltip = "Clears the data."
 position = center image = "/org/opensourcephysics/resources/controls/images/wrench_monkey.gif" action = _tools.showDataTool(_view.angleTrail,_view.FTrail2,_view.torqueTrail2); tooltip = "Opens the data tool."
 variable = vstime text = "vs time"
 variable = vsangle selected = true text = "vs angle"
 variable = Fgraph text = "FBy" background = 0,192,0
 variable = ctadegree0360graph text = "angle" background = 0,192,255 tooltip = "angle"
 variable = torquegraph selected = true text = "TB" background = 0,50,0 foreground = WHITE tooltip = "torque magnetic"
 position = west layout = VBOX visible = false
 position = center variable = sign format = "sign=0"
 position = north variable = sign2 format = "sign2=0.0"
 position = south variable = sign3 format = "sign3=0.0"
 variable = sign4 format = "sign4=0.0"
 variable = F format = "F=0.0"
 variable = torque format = "torque=0.0"
 variable = test format = "test=0.0"
 variable = force format = "force=0.0"