Simple Electric motor simulation
Katherine Arriola <[email protected]> Sat, 29 Nov 2014 12:41:16 -0500
| Newsgroups | gmane.comp.python.visualpython.user |
|---|---|
| Message-ID | <CAFs5PbYpqnT_pejU8Ts8Fdd5KCm3vLwiYLAf=7cdngmiY7Ww3g@mail.gmail.com> |
--===============8327588414524874257== Content-Type: multipart/alternative; boundary=089e013d182a60997a050902e27b --089e013d182a60997a050902e27b Content-Type: text/plain; charset=UTF-8 How to do write a while loop for a ring and cylinder to rotate or turn. I am programming a stimulation that shows how a simple electric motor work. This is what I have so far : from __future__ import division from math import e from visual import* import math scene.title='Simple Electric motor simulation' scene.width = 1000 scene.height = 500 scene.autoscale = 0 scene.range = (35,35,35) scene.center = (12,0,) area=box(pos=(12,0,14),length=400,height=400,width=400,material=materials.plastic,color=(.5,0.5,2)) fcharge=1.6e-19 pweight=1.67e-11 count=0 mfrm=frame(axis=(350,5,10)) #Motor Frame rfrm=frame(frame=mfrm) #Rotor Frame #Electric motor-Jon's battery=frame() cylinder(frame=battery,pos=(0,0,10),axis=(0,0,.2),radius=1.5,color=color.blue,material=materials.emissive) cylinder(frame=battery,pos=(0,0,10.2),axis=(0,0,7.8),radius=1.5,color=(0.5,0.5,0.2)) cylinder(frame=battery,pos=(0,0,12),axis=(0,0,7),radius=.75,color=color.red,material=materials.emissive) #wire-Mine wire=curve(pos=[(0,-6.5,20), (0,0,20), (0,0,8.5),(0,-6.5,8.5)], radius=0.25) #Magnet of motor-Mine floor1 = box (pos=(0,-1.75,14), length=2, height=0.5, width=6, color=color.red) floor2 = box (pos=(0,-2.25,14), length=2, height=0.5, width=6, color=color.blue) #Rotor stucture-Mine # Add Ring and Rod # The armature coil (ring) ring(pos=(0,-6,14),axis=(350,5,10), radius=1.75, thickness=0.5,color=(1,0.5,0.3),material=materials.blazed,) rod1=cylinder(pos=(0,-6,8.5),length=11.5,axis=(0,0.5,100),radius=0.45,color=(1,0.5,0.3), material=materials.blazed,) ring(pos=(0,-6,14),axis=(350,5,10), radius=1.75, thickness=0.5,color=(1,0.5,0.3),material=materials.blazed,) #labeling of program-Mine label1=label(pos=(0,0,10.2), text='Battery', xoffset=17, yoffset=17) label2=label(pos=(0,-6,10), text='Armature', xoffset=47, yoffset=47) print 'end of stimulation' thanks! Kathy --089e013d182a60997a050902e27b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">How to do write a while loop for a ring and cylinder to ro= tate or turn. I am programming a stimulation that shows how a simple electr= ic motor work.<div>This is what I have so far :</div><div><br></div><div><d= iv><br></div><div>from __future__ import division</div><div><br></div><div>= from math import e</div><div>from visual import*</div><div>import math</div= ><div>scene.title=3D'Simple Electric motor simulation'</div><div>sc= ene.width =3D 1000</div><div>scene.height =3D 500</div><div>scene.autoscale= =3D 0</div><div>scene.range =3D (35,35,35)</div><div>scene.center =3D (12,= 0,)</div><div>area=3Dbox(pos=3D(12,0,14),length=3D400,height=3D400,width=3D= 400,material=3Dmaterials.plastic,color=3D(.5,0.5,2))</div><div>fcharge=3D1.= 6e-19</div><div>pweight=3D1.67e-11</div><div>count=3D0</div><div><br></div>= <div><br></div><div><br></div><div>mfrm=3Dframe(axis=3D(350,5,10)) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 #Motor Frame</div><div>rfrm=3Dframe(frame=3Dmfrm) =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#Rotor Frame=C2=A0</div><div><= br></div><div>#Electric motor-Jon's</div><div>battery=3Dframe()</div><d= iv>cylinder(frame=3Dbattery,pos=3D(0,0,10),axis=3D(0,0,.2),radius=3D1.5,col= or=3Dcolor.blue,material=3Dmaterials.emissive)</div><div>cylinder(frame=3Db= attery,pos=3D(0,0,10.2),axis=3D(0,0,7.8),radius=3D1.5,color=3D(0.5,0.5,0.2)= )</div><div>cylinder(frame=3Dbattery,pos=3D(0,0,12),axis=3D(0,0,7),radius= =3D.75,color=3Dcolor.red,material=3Dmaterials.emissive)</div><div><br></div= ><div>#wire-Mine</div><div>wire=3Dcurve(pos=3D[(0,-6.5,20), (0,0,20), (0,0,= 8.5),(0,-6.5,8.5)], radius=3D0.25)</div><div><br></div><div>#Magnet of moto= r-Mine</div><div>floor1 =3D box (pos=3D(0,-1.75,14), length=3D2, height=3D0= .5, width=3D6, color=3Dcolor.red)</div><div>floor2 =3D box (pos=3D(0,-2.25,= 14), length=3D2, height=3D0.5, width=3D6, color=3Dcolor.blue)</div><div><br= ></div><div>#Rotor stucture-Mine</div><div># Add Ring and Rod =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0= </div><div># The armature coil (ring)</div><div>ring(pos=3D(0,-6,14),axis= =3D(350,5,10), radius=3D1.75, thickness=3D0.5,color=3D(1,0.5,0.3),material= =3Dmaterials.blazed,)</div><div>rod1=3Dcylinder(pos=3D(0,-6,8.5),length=3D1= 1.5,axis=3D(0,0.5,100),radius=3D0.45,color=3D(1,0.5,0.3), material=3Dmateri= als.blazed,)</div><div><br></div><div>ring(pos=3D(0,-6,14),axis=3D(350,5,10= ), radius=3D1.75, thickness=3D0.5,color=3D(1,0.5,0.3),material=3Dmaterials.= blazed,)</div><div><br></div><div><br></div><div>#labeling of program-Mine<= /div><div>label1=3Dlabel(pos=3D(0,0,10.2), text=3D'Battery', xoffse= t=3D17, yoffset=3D17)</div><div>label2=3Dlabel(pos=3D(0,-6,10), text=3D'= ;Armature', xoffset=3D47, yoffset=3D47)</div><div>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0<br></div><div><br></div><div>print 'end of stimulation'<= /div></div><div><br></div><div><br></div><div>thanks!</div><div><br></div><= div>Kathy</div></div> --089e013d182a60997a050902e27b-- --===============8327588414524874257== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk --===============8327588414524874257== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Visualpython-users mailing list Visualpython-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/visualpython-users --===============8327588414524874257==--