This is the web version of EJS interface
EJS version 4.3.0
  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=false
  8. LanguageTools=true
  9. EmersionSupport=false
  10. UseInterpreter=true
  11. AuxiliaryFiles=./DCmotor/;
  12. DetectedFiles=./DCmotor/DCmotor.html;

DCmotor

otor/DCmotor
    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=vy1*sign*3
    d y3[i] /dt=vy3*sign*3
    d x2[i] /dt=vx2*sign*3
    d x4[i] /dt=vx4*sign*3
    d x5s[i] /dt=-v0*sign*3
    d x6s[i] /dt=v0*sign*3
    d z7s[i] /dt=vz7*sign3
    d y8s[i] /dt=-vy8*sign3
    d y9s[i] /dt=vy8*sign3
    SolverMidPointTolerance=0.001
    vz7*sign3/2
    //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=y2*sc; z2s=y2*cs; y4s=y4*sc; z4s=y4*cs; 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 //}
    Array
    // created by lookang for slider ctadegree0360 ctadegree = Math.atan2(sc,cs)*180/(pi); if ( ctadegree<0 ) { 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 () { a2=I*L*B*b/Inertia; // from T = inertia.ctadoubledot // from F.b = inertia.ctadoubledot // IBL.b = inertia.ctadoubledot // suspect a2 = ctadoubledot v0=4*size*I; vy1=vx4=v0; vx2=-v0; vy3=-v0; BZ0=-(zmin+(B+2)*range/4); }
    public double getAlpha (double cta) { sign2=sign; // keep the direction of force same. sign2 stored sign for force draw a2*sign2*3 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 sign=1; // 1stQ return a2*Math.abs(Math.cos(cta)); } else if (Math.cos(cta)<=0&&cta02pi>=pi-cta2&&cta02pi>=pi/2&&cta02pi<=pi) { sign=-1; //2ndQ //sign4 = 1; return a2*Math.abs(Math.cos(cta)); } else if(Math.cos(cta)<=0&&cta02pi<=-pi-cta1&&cta02pi>=-pi&&cta02pi<=-pi/2) { sign=-1; // 3rdQ //sign4 = 1; return a2*Math.abs(Math.cos(cta)); } else if (Math.cos(cta)>=0&&cta02pi>=cta1&&cta02pi>=-pi/2&&cta02pi<=0) { sign=1; //4thQ //sign4 = 1; return a2*Math.abs(Math.cos(cta)); } else { sign = 0; // no contact no magnetic force sign4 = 0; return 0; } } else { //sign4 = 1; // for the particles on the battery wires direction of motion 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
    title="Direct Current Electrical Motor Model"
    layout=border
    visible=true
    location="0,-51"
    size="600,600"
    position=center
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin
    maximumY=ymax
    minimumZ=zmin
    maximumZ=zmax
    cameraAzimuth=0.11999999999999933
    cameraAltitude=0.30031596330733257
    cameraFocusX=0.0
    cameraFocusY=0.0
    cameraFocusZ=0.0
    cameraRotation=0.0
    cameraDistanceToScreen=4.919999999999991
    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=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
    x=a
    y=R*sc
    z=R*cs
    sizeX=8*R
    sizeY=0
    sizeZ=0
    lineColor=DARKGRAY
    lineWidth=stroke*3
    x=a
    y=-R*sc
    z=-R*cs
    sizeX=8*R
    sizeY=0
    sizeZ=0
    lineColor=DARKGRAY
    lineWidth=stroke*3
    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=RED
    lineWidth=stroke*3
    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=RED
    lineWidth=stroke*3
    x=a
    y=-R*sc
    z=-R*cs
    sizeX=0
    sizeY=-(sc*lengthz/2-R*sc)
    sizeZ=-(cs*lengthz/2-R*cs)
    lineColor=BLUE
    lineWidth=stroke*3
    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=BLUE
    lineWidth=stroke*3
    x=a-lengthx
    y=0
    z=0
    sizeX=0
    sizeY=sc*lengthz/2
    sizeZ=cs*lengthz/2
    lineColor=RED
    lineWidth=stroke*3
    x=a-lengthx
    y=0
    z=0
    sizeX=0
    sizeY=-(sc*lengthz/2)
    sizeZ=-(cs*lengthz/2)
    lineColor=BLUE
    lineWidth=stroke*3
    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=RED
    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=BLUE
    lineWidth=stroke*5
    x=8*R+a
    y=0
    z=R*1.15
    sizeX=R/4
    sizeY=R/4
    sizeZ=R/4
    fillColor=RED
    x=8*R+a
    y=0
    z=-R*1.15
    sizeX=R/4
    sizeY=R/4
    sizeZ=R/4
    fillColor=BLUE
    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
    solenoid=10
    loops=10
    pointsPerLoop=10
    lineColor=0,0,200,255
    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
    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
    measured=true
    radius=R/10
    solenoid=3
    loops=3
    pointsPerLoop=3
    lineColor=GREEN
    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
    elementposition=SOUTH_WEST
    lineColor=BLACK
    fillColor=BLACK
    lineWidth=stroke*3
    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=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/16
    fillColor=WHITE
    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
    pixelSize=true
    text="+"
    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/16
    fillColor=WHITE
    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
    pixelSize=true
    text="+"
    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=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=vx4*sign*3
    sizeY=0
    sizeZ=0
    visible=showV
    lineColor=MAGENTA
    fillColor=MAGENTA
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin
    maximumY=ymax
    minimumZ=BZ0
    maximumZ=0
    xcomponent=bfx
    ycomponent=bfy
    zcomponent=bfz
    length=xmax*B
    visible=showBF
    mincolor=ORANGE
    maxcolor=ORANGE
    z=zmax*1.5
    text=%l_current%
    lineWidth=stroke
    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=B<0
    x=0
    y=0
    z=-(zmin-zmax)/2
    sizeX=xmax-xmin
    sizeY=ymax-ymin
    sizeZ=(zmax-zmin)/8
    lineColor=GRAY
    fillColor=255,0,0,100
    resolution="1,1,1"
    x=0
    y=0
    z=-(zmin-zmax)/1.8
    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
    lineColor=GRAY
    fillColor=0,0,255,100
    resolution="1,1,1"
    x=0
    y=0
    z=(zmin-zmax)/1.8
    text="S"
    font=Monospaced,BOLD,30
    lineColor=BLACK
    fillColor=BLACK
    position=south
    layout=GRID:0,1,0,0
    layout=HBOX
    position=center
    layout=GRID:1,0,0,0
    variable=ctadegree0360
    value=0
    minimum=0
    maximum=360
    format="$\\theta$ = 000 deg"
    enabled=false
    background=0,192,255
    tooltip="angular displacement of armature"
    variable=omegadegree
    minimum=-360
    maximum=360
    format="$\\omega$ = 000 deg/s"
    enabled=false
    background=200,0,200,255
    tooltip="angular velocity of armature"
    variable=(getAlpha(cta) -bf*omega)*180/pi
    minimum=-50
    maximum=50
    format="$\\alpha$ = 000 deg/(s*s)"
    enabled=false
    background=200,0,0,255
    tooltip="angular acceleration of armature"
    variable=t
    minimum=0
    maximum=100
    format="t = 0.0 s"
    enabled=false
    tooltip="time t"
    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=a2*sign2
    minimum=-2
    maximum=2
    format="FBy = 0.0 N"
    enabled=false
    background=0,192,0
    tooltip="Fy magnetic = I*B*L*sin(I&B)"
    variable=a2*sign2*R*cs*4*2
    minimum=-2
    maximum=2
    format="TB = 0.0 N m"
    enabled=false
    background=0,192,0
    tooltip=" magnetic Torque = I*B*L*sin(I&B)*AD*cos(cta), clockwise positive"
    layout=HBOX
    variable=cta2degree
    value=80
    minimum=0.0
    maximum=80
    format="$\\beta$2 = 0.0 deg"
    dragaction=_initialize()
    background=0,192,255
    tooltip="split ring commutator angle for contact in degree"
    variable=I
    value=1
    minimum=-2
    maximum=2.0
    format="I=0.00"
    dragaction=setparam ()
    background=YELLOW
    tooltip="current in the circuit suppied by the battery"
    layout=HBOX
    variable=showBF
    mnemonic="b"
    background=ORANGE
    tooltip="To visualize the external magnetic field from the NS magnets in the z direction"
    position=center
    variable=B
    value=0.8572000000000002
    minimum=-2.0
    maximum=2.0
    format="Bz=0.00"
    dragaction=setparam ()
    background=ORANGE
    tooltip="External magnetic field from the NS magnets in the z direction"
    variable=bf
    value=0.2
    minimum=0.0
    maximum=1.0
    format="F friction = - 0.0*$\\omega$"
    background=0,192,0
    tooltip="friction force based on model F friction = -k.$\\omega$"
    variable=Inertia
    value=1.0
    minimum=1.0
    maximum=7.0
    format="Inertia = 0.0"
    ticks=7
    closest=true
    tooltip="Inertia of the physical dimensions of the DC motor"
    layout=VBOX
    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=true
    text=%l_current%
    mnemonic="c"
    action=if(Is){ sign=1.; sign3 =-sign3; // 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{ sign=-1.; sign3=sign3; // 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"
    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"