[quote author=Fu-Kwun Hwang link=topic=912.msg3432#msg3432 date=1233505003]
Here is the real motor:

In order to make motor reach stable rotational motion. A friction force is introduced: F=-constant *b*omage;//where b is the width in y-direction
Even thought magnitude of the magnetic force is the same (black arrows),
 the torque is a function of cos(w*t)

<applet code="users.ntnu.fkh.currentloopinbmotor_pkg.currentloopinbmotorApplet.class" codebase="/ntnujava/ejs4/" archive="ejs_currentloopinbmotor.jar" name="currentloopinbmotor" id="currentloopinbmotor" width="626" height="628"></applet>

If the process is reversed: A loop rotating in a uniform magnetic field will become electric power generator.
Please check out [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=915.0]A loop rotating in a magnetic field (How electric power generator works!)[/url]

Hi Prof!
i think i found a small bug that did not affect the simulation model because the inertia in your sim is always 1

the logic is
dcta/dt = omega

domega/dt = (getAlpha(cta) -bf*omega)/Inertia

because (getAlpha(cta) -bf*omega) = resultant torque

so magnetic torque = getAlpha(cta)
and magnetic force is F= N*I*L*B*sign2;

the a2 is actual the a2=N*I*L*B*b; (in my DC sim Ejs Open Source DC Motor Model by Fu-Kwun Hwang and lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1266) instead of   a2=I*L*B*b/Inertia (in your current DC sim http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=912.msg3432#msg3432;
ignore my N because i have modified the sim into a multi turns DC motor.

is my interpretation of the physics DC model correct?

In other words,
your model should be like this
dcta/dt = omega
domega/dt = (getAlpha(cta) -bf*omega)[b][color=blue]/Inertia[/color][/b]
where a2=I*L*B*b; for your case, since your (or our) a2 is the torque*length b
need to modify code at 2 places.