---
title: "Windings lab: winding factors, MMF and induced voltage"
heading: Winding factors for any harmonic, the MMF of a real winding built up slot by slot and checked against the formula, forward and backward fields from any set of phase currents, and the harmonic content of the voltage a winding generates
eyebrow: S12 · Lesson 13 · Windings lab
xp: 60
---

::: hook
Lessons 7 to 9 described windings with formulas: distribution and pitch factors, a fundamental MMF of $\frac32\frac4\pi\frac{k_wN_\text{ph}}{P}I$, voltage harmonics scaled by their winding factors. In this lab you'll compute the winding factors for any layout, then build the MMF of an actual winding from its slot currents, staircase and all, and check that its fundamental matches the formula to many digits. You'll finish with the fields of unbalanced currents and the harmonics a winding passes into its voltage.
:::

::: play
- The stems are the winding factors of a three-phase winding with 2 slots per pole per phase and the coil pitch on the slider, for harmonics 1 to 19 (odd).
- Full pitch passes the 5th and 7th; 5/6 pitch suppresses both to about 0.07.
- The 11th and 13th, at $6q \pm 1$, keep the fundamental's distribution factor whatever the pitch: the slot harmonics.
:::

```sim plot
view: graph
x: h = 1..19
y: k = 0..1
samples: 10
slider: r = 0.6..1 = 0.833
plot: abs(sin(h*pi/6)/(2*sin(h*pi/12))*sin(h*r*pi/2)) | stems | label: winding factor
```

::: predict
## A 36-slot, 4-pole, single-layer, full-pitch winding with 10 conductors per slot carries 10 A peak in phase a and −5 A in phases b and c. The formula predicts a fundamental MMF of 275 A·turns per pole. What does adding up the slot currents give?

- [ ] About 300, because the staircase has extra harmonics
- [x] 275, the same to many digits
- [ ] About 260, because of the slot openings
- [ ] Half that

::: reveal
The staircase has harmonics, but its fundamental is exactly the sum of each slot's contribution, which is what the distribution factor computes. Task 2 builds the staircase slot by slot and extracts its fundamental numerically: 274.96 A·turns against the formula's 274.96.
:::
:::

::: nameit
## What the lab computes

- **Winding factors**: for Q slots, P poles and a coil pitch of y slots, $q = Q/3P$, slot angle γ = 60°/q (electrical), pitch fraction ρ = yP/Q, and for harmonic h
$$k_{dh} = \frac{\sin(hq\gamma/2)}{q\sin(h\gamma/2)}, \qquad k_{ph} = \sin(h\rho\pi/2)$$
- **MMF from slots**: in a single-layer, full-pitch winding the slots form phase belts in the order a, −c, b, −a, c, −b, each q slots wide. With Z conductors per slot and instantaneous currents, each slot carries Z times its phase's current (with the belt's sign). The MMF just past any point of the gap is the running sum of slot currents, less its mean. Its fundamental, at P/2 cycles per revolution, should be $\frac32\frac4\pi\frac{k_wN_\text{ph}}{P}I$ for balanced currents of peak I, with $N_\text{ph} = QZ/6$.
- **Forward and backward fields**: the positive- and negative-sequence currents, $I_1 = \frac13|I_a + aI_b + a^2I_c|$ and $I_2 = \frac13|I_a + a^2I_b + aI_c|$, scale the forward and backward MMFs.
- **Voltage harmonics**: a field harmonic $B_h$ induces $E_h/E_1 = (B_h/B_1)(k_{wh}/k_{w1})$; line-to-line voltages lose the triplen harmonics.
:::

::: check
kind: python

## Write `winding_factor(Q, P, y, h)` returning $(k_d, k_p, k_w)$ as magnitudes for harmonic h.

```python starter
def winding_factor(Q, P, y, h):
    return 1.0, 1.0, 1.0
```

```python solution
import math

def winding_factor(Q, P, y, h):
    q = Q / (3 * P)
    g = math.pi / (3 * q)
    kd = math.sin(h * q * g / 2) / (q * math.sin(h * g / 2))
    kp = math.sin(h * (y * P / Q) * math.pi / 2)
    return abs(kd), abs(kp), abs(kd * kp)
```

```python tests
kd, kp, kw = winding_factor(36, 6, 5, 1)
assert abs(kw - 0.9330) < 1e-4, "36 slots, 6 poles, 5/6 pitch: 0.933."
assert abs(winding_factor(36, 6, 5, 5)[2] - 0.0670) < 1e-4, "The 5th: 0.067."
assert abs(winding_factor(36, 6, 5, 11)[2] - kw) < 1e-12, "The 11th, a slot harmonic, matches the fundamental."
assert abs(winding_factor(36, 4, 9, 1)[0] - 0.9598) < 1e-4 and abs(winding_factor(36, 4, 9, 1)[1] - 1) < 1e-12, "36 slots, 4 poles, full pitch: q = 3."
```

::: right
Right. Pitch and distribution suppress some harmonics strongly, but never the slot harmonics.
:::
:::

::: check
kind: python

## Write `slot_mmf(Q, P, Z, ia, ib, ic, M=7200)`: the zero-mean MMF of a single-layer, full-pitch winding at M points around the gap (slot k centered at angle (k + ½)·2π/Q), and `fundamental(F, P)`: the amplitude of its P/2-cycle component.

```python starter
def slot_mmf(Q, P, Z, ia, ib, ic, M=7200):
    return [0.0] * M

def fundamental(F, P):
    return 0.0
```

```python solution
import cmath, math

def slot_mmf(Q, P, Z, ia, ib, ic, M=7200):
    q = Q // (3 * P)
    belts = [("a", 1), ("c", -1), ("b", 1), ("a", -1), ("c", 1), ("b", -1)]
    cur = {"a": ia, "b": ib, "c": ic}
    slots = []
    for k in range(Q):
        ph, sg = belts[(k // q) % 6]
        slots.append(sg * cur[ph] * Z)
    F, total, k = [], 0.0, 0
    for i in range(M):
        phi = 2 * math.pi * (i + 0.5) / M
        while k < Q and (k + 0.5) * 2 * math.pi / Q < phi:
            total += slots[k]
            k += 1
        F.append(total)
    mean = sum(F) / M
    return [x - mean for x in F]

def fundamental(F, P):
    M = len(F)
    p = P // 2
    c = sum(F[i] * cmath.exp(-1j * p * 2 * math.pi * (i + 0.5) / M) for i in range(M)) * 2 / M
    return abs(c)
```

```python tests
import math
F = slot_mmf(36, 4, 10, 10.0, -5.0, -5.0)
q = 3
kd = math.sin(math.pi / 6) / (q * math.sin(math.pi / (6 * q)))
assert abs(fundamental(F, 4) - 1.5 * 4 / math.pi * kd * 60 / 4 * 10) < 0.01, "The staircase's fundamental matches the formula: 275 A·turns."
assert abs(sum(F)) < 1e-6, "The MMF has no average: flux leaving the rotor returns."
F2 = slot_mmf(36, 4, 10, 10 * math.cos(0.3), 10 * math.cos(0.3 - 2 * math.pi / 3), 10 * math.cos(0.3 + 2 * math.pi / 3))
assert abs(fundamental(F2, 4) - fundamental(F, 4)) < 1e-6, "Balanced currents at another instant: the same amplitude, rotated."
```

::: right
Right. The rotating fundamental keeps its amplitude at every instant; only the harmonics of the staircase flicker.
:::
:::

::: check
kind: python

## Write `forward_backward(Ia, Ib, Ic)`: from complex phase currents, the magnitudes of the positive- and negative-sequence currents, which scale the forward and backward fields.

```python starter
def forward_backward(Ia, Ib, Ic):
    return abs(Ia), 0.0
```

```python solution
import cmath, math

def forward_backward(Ia, Ib, Ic):
    a = cmath.exp(2j * math.pi / 3)
    return abs(Ia + a * Ib + a * a * Ic) / 3, abs(Ia + a * a * Ib + a * Ic) / 3
```

```python tests
import cmath, math
a = cmath.exp(2j * math.pi / 3)
f, b = forward_backward(1, a * a, a)
assert abs(f - 1) < 1e-12 and b < 1e-12, "Balanced: forward only."
f, b = forward_backward(1, -1, 0)
assert abs(f - 1 / math.sqrt(3)) < 1e-12 and abs(b - 1 / math.sqrt(3)) < 1e-12, "A lost phase: equal forward and backward, 0.866F each against 1.5F."
f, b = forward_backward(1, a * a * 0.9, a)
assert b > 0 and abs(f + b - 1) < 0.05, "A weak phase: mostly forward with a little backward."
```

::: right
Right. A lost phase leaves the motor with only 58% of its forward field and an equal backward field braking it.
:::
:::

::: check
kind: python

## Write `voltage_thd(B, Q, P, y)`: given a dict of air-gap field harmonics relative to the fundamental, {h: Bh/B1}, return the phase-voltage THD and the line-to-line THD (triplen harmonics removed) for the winding.

```python starter
def voltage_thd(B, Q, P, y):
    return 0.0, 0.0
```

```python solution
import math

def wf(Q, P, y, h):
    q = Q / (3 * P)
    g = math.pi / (3 * q)
    return abs(math.sin(h * q * g / 2) / (q * math.sin(h * g / 2)) * math.sin(h * (y * P / Q) * math.pi / 2))

def voltage_thd(B, Q, P, y):
    k1 = wf(Q, P, y, 1)
    e = {h: b * wf(Q, P, y, h) / k1 for h, b in B.items()}
    phase = math.sqrt(sum(v * v for v in e.values()))
    line = math.sqrt(sum(v * v for h, v in e.items() if h % 3 != 0))
    return phase, line
```

```python tests
p, l = voltage_thd({3: 0.2, 5: 0.05, 7: 0.03}, 36, 6, 5)
assert abs(p - 0.1073) < 1e-4, "Phase voltage: 10.7%, mostly the 3rd."
assert abs(l - 0.00419) < 1e-5, "Line voltage: 0.42%, the triplens gone and the 5th and 7th suppressed."
p2, l2 = voltage_thd({3: 0.2, 5: 0.05, 7: 0.03}, 36, 6, 6)
assert abs(l2 - 0.0156) < 1e-4 and l2 > 3 * l, "Full pitch passes 3.7 times as much of the 5th and 7th: 1.56%."
```

::: right
Right. The Y connection removes the triplens, and short pitching removes most of what's left.
:::
:::

::: explain
## Why can't a winding's pitch or distribution suppress its slot harmonics?

::: model
Harmonics of order $6q \pm 1$ have a wavelength such that adjacent slots are displaced by an angle that differs from the fundamental's by a whole multiple of 360° (electrically, for that harmonic), so the coils in a phase belt add for those harmonics exactly as they add for the fundamental, and the distribution factor is the same. The pitch factor likewise repeats, because the pitch angle for those harmonics differs from the fundamental's by a whole number of half-turns. Anything that reduced them would reduce the fundamental equally, so designers suppress slot harmonics by other means: skewing the slots, using fractional slots per pole per phase, or shaping the magnet or pole face.
:::
:::
