The Physics
The salient dynamics of an electric motor are governed by electromagnetic interactions and mechanical dynamics of a spinning mass. We'll need circuit theory to describe the electrical dynamics and understand magnetic moments to relate the electrical and mechanical dynamics.
Faraday's Law
The voltage across an inductor is given by Faraday's law of induction. The voltage is
proportional to the rate of change of the magnetic flux through the inductor. The magnetic
flux is proportional to the current flowing through the inductor. The magnetic flux can be
generated either by the coil or by the permanent magnet. The effect on the phase windings
is encapsulated in the magnetic flux linkage
Where the symbols mean:
is time, of course. is the voltage generated across the inductor. is the current flowing through the inductor. is the magnetic flux passing through the inductor. is the magnetic flux linkage of the inductor; which is the magnetic flux passing through the coil surface multiplied by the number of turns in the coil. is the number of turns in the inductor winding. is the inductance of the inductor. is the magnetic flux self-linkage generated by the current flowing through the inductor. is the magnetic flux linkage due to the permanent magnet rotor. is the angle between the magnetic north of the magnet and the inductor winding. is the unit vector in the direction of the inductor winding.
Rotational Mechanics
We'll use a simple model for the mechanics, we assume a rotor with rotational inertia
Torque Generation
The driving torque
Where the symbols mean:
is the magnetic moment of the inductor winding. is the magnetic field of the permanent magnet rotor. is the surface area of the inductor winding in the direction of the winding.
Motor equations
We'll use a permanent magnet motor with 3 balanced phases. The motor is connected in a Y/star configuration and has 1 pole pair per phase. We'll simplify our model by assuming no mutual induction between phases and no saturation effects in the iron core.
The motor electrical and mechanical dynamics can be described by the following equations:
Where the symbols mean:
are the voltages across the stator windings; with respect to the Neutral common node of the Y/star configuration. are the currents through the stator windings; positive from the Neutral to the phase connection. is the phase winding resistance. We assume this is equal for all phases. is the phase winding inductance. This should actually be an inductance matrix, but we assume it is diagonal for simplicity; and also equal for all phases. are the flux linkages of the stator windings. This is where is the number of turns in the winding and is the magnetic flux through the winding. is the magnetic flux linkage due to the permanent magnet rotor. is the rotor electrical angle. The North pole of the rotor magnet will be aligned with the winding for phase A when . is the electromagnetic torque produced by the motor. The formula computes the torque on the magnetic moments of the phase windings; the rotor torque will be equal and opposite to this. is the rotor electrical angular velocity. is the rotor moment of inertia downscaled by pole pairs. We work in electrical radians so the physical coefficients have to be downscaled by the number of pole pairs. For this motor, we have 1 pole pair per phase, so the coordinates match up. is the load torque on the rotor. is the friction torque on the rotor. is the dynamic friction torque on the rotor.
Radial Forces
The rotor will experience forces pushing it away from its axis of rotation when the magnetic fields of the stator and rotor align. Under ideal operation the motor driver tries to keep the stator field perpendicular to the rotor field to maximize its useful torque. The alignment of the fields is a symptom of inefficiencies in the motor driver. We can also hear the motor disturbances as noise, the typical high pitched whine of an electric motor. The other noise source of the motor is the gear train which we cannot control electronically.
A magnetic moment in an external magnetic has potential energy
The motor under simulation consists of a rotor with a relatively large magnet surrounding a stator core, with an air gap between them. The exact dynamic of the magnetic field is complex so we must make some approximations. Because the air gap is small compared to the rotor magnet we'll consider the magnetic field to fall-off from a monopole moment. For the distance we'll use the maximum air gap anywhere along the circumference as the rotor wobbles around the stator.
To obtain the radially acting force we need to differentiate the potential energy with respect
to the displacement distance
The forces are acting in the direction of each stator winding, the total force acting on the rotor is the sum of the forces acting on each winding.
Where the symbols mean:
is the radial displacement on the x axis. is the radial displacement on the y axis. represents term by term multiplication (we use it to get the projection on each axis). is the radial displacement anywhere around the circumference. is default air gap between the rotor and stator. is the magnetic flux linkage at the rotor surface with the default air gap. is the radial force acting on the rotor.
We'll use the power equations
Where the symbols mean:
is the power dissipated by the radial force acting on the rotor. is the back emf generated by the radial displacement. is the radial velocity of the rotor. is the angle of the radial velocity vector.
Equations with Radial Displacement
We can now gather all the equations we need to simulate the motor dynamics including the noisy
radial displacement, which are a symptom of innefficiencies in the motor driver. Include the
radial back emf in the electrical differential equation
Electrical Connections
The motor is connected in a Y/star configuration. Each phase is connected to a half-bridge between two N-channel MOSFETs.
Phase to Phase Voltages
We can only control the phase to phase voltages
MOSEFT Connections
The phases are connected to MOSFET half-bridges which can be controlled by PWM signals. At any
instant the MOSFET bridges are either turned on or off; however when turned off the MOSFET body
diode will allow current to flow in the reverse direction, from source to drain. (This diode
effect is present in all MOSFETs due to their construction). In the cases where the MOSFET is
turned on, it will act as a resistance with low resistance
Current circulating in the inductive phase windings will continue circulating when we switch the MOSFET state. Because of the arrangement of the MOSFET connections, the current will always find a path between the phases. We can determine which diode is conducting by the current flowing in each phase. If it's positive current (which we define as current flowing out of the phase winding), the HIGH side diode will conduct, while if it's negative the LOW side diode will conduct.
Overall, we either short the phase to phase connection, or present the battery voltage. The MOSFETs will have voltage drop either from the resistance or the body diode depending on which is conducting. The voltage drop across the U to V phase are given below, and the rest can be derived by symmetry:
[TODO] this gotta be fixed.
Where the symbols mean:
are the voltages applied between each pair of phases. is the battery voltage. is the voltage drop across the MOSFET body diode. is the resistance of the MOSFET when turned on.