Mathematical Derivations for Motor Python Calculator
The following derivations explains the equations in each part of the Python code.
Variables and unit references can be found here.
1. AWG Wire Geometry
Referencing the equation for motor AWG gauge ($n_g$) to wire diameter d($n_g$), in mm:
\[d(n_g) = 0.127 * 92 ^{\frac{36-n}{39}}\]And cross sectional area $A(n_g)$, in $mm^2$:
\[A(n_g) = \frac{\pi*d(n)^2}{4}\]When using multiple strands, an effective area $A_{total}$ from the number of strands $n_s$, as well as its equivalent AWG gauge $AWG_{equiv}$:
\(A_{total} = n_s * A(n_g)\) \(d_{equiv} = 2\sqrt{\frac{A_{total}}{\pi}}\) \(AWG_{equiv} = 36 - 39 * \log_{92} (\frac{d_{equiv}}{0.127})\)
2. Copper Resistance
A function for copper resistivity $\rho$ ($\Omega*m$) is estimated over motor operating temperature T for annealed copper:
\[\rho(T) = \rho_{20C} * (1 + \alpha (T-20))\]where $\alpha = 0.00393/C$ , and $\rho_{20C} = 1.724 x 10^{-8} \Omega*m$.
Then, resistance per unit length in $\Omega/m$ is calculated using the total effective area $A_{total}$ accounting for strand count $n_s$:
\[R_{per_{m}} = \frac{\rho(T)}{A_{total}*n_s}\]Then, the coil resistance $R_{coil}$ is found when factoring in turn count $n_t$ and mean turn length MTL (mm):
\[R_{coil} = R_{per_{m}} * (n_t * \frac{MTL}{1000})\]Where MTL is calculated based on measured stator lamination width $w_{tooth}$ and stator stack length $L_{STACK}$, both in units of mm. A correction factor $C_w$ (mm) is added for buildup, in the form of extra length. This can be measured or inferred, but nevertheless tunable in the calculator, to see how it affects final calculations.
\[MTL = 2 * (w_{tooth} + L_{stack}) + C_w\]3. Turns, KV and Kt Relationship (For Star/Wye, 3-phase, sinusoidal)
The K-constant is a function of turn count and motor KV, so it is independent of how many stator teeth/slots there are. This is further elaborated on in Section 8, as it’s probably the most significant scaling factor of KV and to be validated in experimental setups.
\[K = n_t * KV\]i. KV to Ke
Derivation of Kt from KV, an ideal approximation for sine-commutated BLDC motors, and line-to-line KV:
First, $K_e$ and $KV$ are reciprocals of one another when units are matched.
\[K_e (\frac{V}{rad/s}) = \frac{1}{KV} (\frac{V}{rev/min}) * (\frac{1 rev}{2\pi rad}) * (\frac{1 min}{60s})\] \[K_{e, line} = \frac{1}{KV_{line}} * \frac{2\pi}{60}\]The above expression is for line-to-line characteristics, since KV is often measured from phase-to-phase using test hardware (since in star configurations, the neutral point is usually inaccessible).
However, these equations assume $K_e$ from star-to-phase characteristics, so the value must be converted for subsequent calculations.
For a star winding, the line voltage and the phase voltage vary by a factor of $\sqrt{3}$ as per the characteristics of tying the phases together at a neutral point:
\[V_{phase} = V_{line} / \sqrt{3}\] \[\therefore K_{e, phase} = \frac{1}{KV_{line}} * \frac{2\pi}{60} * \frac{1}{\sqrt{3}}\]ii. Power, Torque, Back-EMF, and Flux Linkage Relations
We can then find the torque constant $K_t$ by summing the instantaneous power from three phases, offset 120 ° from each other in a 3-phase motor.
Torque is related to power $P = V*I$. In a moving motor, this will be the instantaneous product of the back-EMF waveform and the current waveform.
Earlier in the repo it is mentioned that change in flux linkage (due to the cutting of the motor across the magnetic field during motor motion) is related to back-EMF, which is related to torque. Here, we can spell it out by referencing both the torque equation as well as the back-EMF equation that references change in flux linkage. In other words, they describe the spatial rate of change of flux linkage and the temporal rate of change of flux linkage, respectively.
\[\tau = I_{phase} * \frac{d\lambda}{d\theta}\]Where $\lambda$ is the flux linkage (Wb), defined as $\lambda = n_t\phiK_w$.
\[E = \omega * \frac{d\lambda}{d\theta}\]Where E is the back-EMF (V), and $\omega$ is the angular velocity of the rotor (rad/s).
You can further prove that both $\frac{d\lambda}{d\theta}$ values are the same if you play around with some unit conversions, but I won’t bother in this module. We can obtain an energy balance equation between $E, I_{phase}, \tau, \omega$ from the two above equations:
\[E * I_{phase} = \tau * \omega\]The left side of the equation is a simple voltage * current expression - an expression for power (W). Likewise, the right side is also the expression for power in terms of torque, if you remember from physics class. This is another way to arrive at these equations, but I wanted to also connect the impact of flux linkage for the sake of motormaxxing.
In ideal field-oriented control (FOC), the back-EMF is sinusoidal, as well as the phase current. Maximum torque is then achieved when E and $I_{phase}$ are in phase with each other. We can describe both sinusoidal waves as a function of the maximum EMF and current with the following:
\[E = E_{max} * cos(\theta)\] \[I_{phase} = I_{max} * cos(\theta)\] \[\therefore\] \[E * I_{phase} = E_{max} * I_{max} * cos^2(\theta).\]Finally, we can obtain the average value of $cos^2(\theta)$ over one period. You can derive this using cosine trig identities, but for the sake of showing why cos and sin would be equal:
\[cos^2(\theta) + sin^2(\theta) = 1\]Since the above is always true, it implies the average value of each term is 1/2.
And for three phases,
\[3 * \frac{1}{2} = \frac{3}{2}.\] \[I_{total} = \frac{3}{2} * I_{max}\] \[E * I_{total} = E_{max} * I_{max} * \frac{3}{2} = \tau*\omega = P_{Ideal}.\]iii. Ke to Kt
After all this, we can obtain a relation between $K_t$ and $K_e$ for a motor commutated by FOC:
By definition, the peak back-EMF $E_{max}$ is the back-EMF constant $K_e$ times speed:
\[E_{max} = K_e * \omega,\]Plugging this in for $E_{max}$ from the previous energy balance equation but for all three phases (equating power to power, using $E, I, \tau, \omega$):
\[P_{total} = E_{max} * I_{max} * \frac{3}{2} = \tau*\omega\] \[P_{total} = K_e * \omega * I_{max} * \frac{3}{2} = \tau*\omega\] \[K_e * I_{max} * \frac{3}{2} = \tau.\]Finally, the torque constant $K_t$ is defined as torque per peak current $\tau = K_t * I_{max}$.
Substituting this in,
\[K_e * I_{max} * \frac{3}{2} = K_t * I_{max},\] \[\therefore K_e * \frac{3}{2} = K_t.\]iv. KV to Kt
Plugging in $K_e$ in terms of $KV$, utilizing the equivalence derived earlier, we can finally obtain a relation between $K_t$ and $KV$.
\[K_t = \frac{3}{2} * \frac{1}{\sqrt{3}} * \frac{60}{2\pi} * \frac{1}{KV}\] \[K_t = 8.27/KV\]4. Current Translation
Here, derivations of current and resistance from various winding configurations as well as star/delta are provided.
i. Series vs. Parallel
The term $R_{coil}$ refers to the resistance of a single coil, or one wound tooth (accounting for all $n_t$ turns completed, which is broken down in Section 2. Teeth per phase $n_{TPP}$ will be 1/3 of the total stator teeth for a double layer winding.
For series windings:
\[I_{phase} = I_{coil}\] \[R_{phase} = n_{TPP} * R_{coil}\]For parallel windings:
\[I_{phase} = I_{coil} * n_{TPP}\] \[R_{phase} = R_{coil} / n_{TPP}\]A cross-check is performed using the Joule’s law, $I_{phase}^2*R_{phase}$ for calculating power loss in each phase:
Series: $P_{loss} = I_{coil}^2 * n_{TPP} * R_{coil}$
Parallel: $P_{loss} = I_{coil}^2 * n_{TPP}^2 * \frac{R_{coil}}{n_{TPP}} = I_{coil}^2 * n_{TPP} * R_{coil}$
The copper loss is effectively the same for both configurations.
ii. Delta vs. Wye
For Star / Wye configuration:
\[V_{line} = V_{phase} * \sqrt{3}\] \[I_{line} = I_{phase}\]For Delta configuration:
\[V_{line} = V_{phase}\] \[I_{line} = I_{phase} * \sqrt{3}\]As mentioned prior, a delta configuration would have a different KV factor:
\[KV_{delta} = KV_{star} * \sqrt{3}\]6. Slot Fill
Here, the tangibility of $n_t$ turns of a coil with $n_s$ strands with certain AWG $n_g$ is weighed in regards to stator tooth size.
Total winding area:
\[A_{wind} = n_s * n_t * A(n_g)\]Estimation of total available slot area will require some measurements of the gap at the top and the bottom between each stator tooth as well as the depth of each tooth, since slots will usually be of a trapezoidal shape. Measuring along the center of the tooth’s depth and multiplying to the pitch may also provide a decent estimate. However, due to hand-winding imperfections and the size of the fillets on each tooth, this is meant to serve as a simple estimation.
\[A_{slot} = \frac{W_{slot, out} + W_{slot, in}}{2} * r_{depth}\]Fill factor:
\[f = A_{wind} / A_{slot}\]The calculator, as a default, will trip for overfill at 42%, since a theoretical maximum of 50% of the slot space can be filled (in a double layer winding). However, more leeway will be necessary for hand-wound motors that may not perfectly minimize area taken up by copper.
7. Winding Factor
\[K_w = K_p * K_{skew} * K_d\]As a default, Kp = Kskew = 1 for concentrated windings and no skew.
\[K_p = cos(\frac{a_{chord}}{2})\]where $a$ is the chording angle, in electrical degrees, or coil pitch angle - pole pitch angle.
For skew, it is dependent on the skew angle $\alpha_{skew}$, expressed in electrical radians:
\[K_{skew} = \frac{sin(a_{skew}/2)}{a_{skew}/2}\]For a distributed winding (q>=1), The distribution factor $K_d$ is dependent on the electrical angle between two slots $\gamma$, slots per pole per phase $q$.
\[q = \frac{N_{slots}}{3*N_{poles}}\]Since electrical angle tracks back-EMF waveform, which spans a full N-S cycle of PM poles, the number of pole pairs $N_{poles}/2$ is used for $\gamma$:
\[\gamma = 2\pi * \frac{N_{poles}}{2*N_{slots}}\] \[K_w = K_d = \frac{sin(\frac{\gamma * q}{2})}{\frac{\gamma*q}{2}}\]8. Motor Constant K
The motor constant K can either be experimentally derived by measuring KV or analytically derived using mechanical and electrical properties. It is simply KV, in RPM/V multiplied by the number of turns.
$K =$ turns * KV
K itself is a function of both mechanical attributes and electrical attributes:
\[K = \frac{60/2\pi}{C_{SD} * N_{TPP} * K_w * (N_{poles}/2) * \phi_{Pole}}\] \[\phi_{Pole} = B_g * A_{pole}\] \[A_{pole} = (\frac{2\pi * r_{gap} * L_{stack}}{N_{poles}})\]Where $B_g$ can be estimated, or calculated using:
\[B_g = \frac{B_r * L_M}{L_M + (\mu_r*g)}\]The simplified analytical equation for $K_c$ using all inputted variables is:
Star:
\[K = \frac{60/2\pi}{\sqrt{3} * N_{TPP} * K_w * (N_{poles}/2) * \frac{B_r * L_M}{L_M + (\mu_r*g)} * (\frac{2\pi * r_{gap} * L_{stack}}{N_{poles}})}\] \[K = \frac{1}{\sqrt{3}} * \frac{30*(L_M + (\mu_r * g))}{\pi^2 * N_{TPP} * K_W * B_r * L_M * r_{gap} * L_{stack}}\]8. Corrections to the Corrections (Carter Coefficients/Airgap, Slot Leakage, Pole Arc, Temperature/Remanence, Back-Iron)
i. Carter Coefficient $K_{cs}$ and $K_{cr}$
The first of many corrections for K, the Carter coefficient is used to correct the effective airgap length $g$ by considering the stator and rotor magnet/slot spacing.
\[g' = K_c * g\]The formula for $K_c$ depends on the slot pitch $t_s$ (which is a function of diameter D and number of slots $n_{slots}$, the width of each slot opening $w_s$, and the airgap $g$.
\[t_s = \frac{\pi*D}{n_{slots}}\] \[K_c = \frac{t_s}{t_s - \sigma*w_s}\]Where $\sigma$ is a function of the slot width to airgap ratio:
\[\sigma = \frac{w_s/g}{5+ (w_s/g)}\]This is to be calculated for both the stator ($K_{CS}$) and the rotor ($K_{CR}$) since both contain slots.
Finally, the effective airgap g’:
\[g' = g * K_{CS} * K_{CR}\]Note: $K_c$ should always be greater than 1.
ii. Slot Leakage $k_{\sigma}$ and Pole Arc Correction
Slot leakage $k_{sigma}$ uses an estimated range of values (0.85-0.95), rather than derived.
A correction for the pole arc A_{pole} is corrected using the pole arc coefficient \alpha_i, resulting in an adjusted pole flux.
\[\phi_{pole, corrected} = \alpha_i * B_g * A_{pole}\] \[\alpha_i = \frac{1-w_{s, rotor}}{t_{s,rotor}}\]iii. Temperature Remanence Flux Derating
An adjustment of remanent flux density $B_r$ is applied to account for increased operating temperatures, as it will decrease with increased temperature, affecting K.
\[B_r(T) = B_{r, 20C} * (1 + \alpha * (T - 20))\]iv. Back-Iron (Rotor Ring Material)
The magnetic permeability $\mu_r$ of the rotor ring that houses the PM magnets is considered, as flux $B_g$ can be enhanced for ferromagnetic “back-iron” as opposed to a plastic FDM printed ring, for example.
\[B_g = \frac{B_r * L_m}{g' + \frac{t_{rotor}}{\mu_{r, rotor}} + \frac{t_{stator}}{\mu_{r,stator}} }\]Where $\mu_r$ is the magnetic permeability, in H/m or T*m/A.