---
title: "DC and PM motor lab: characteristics, efficiency and dynamics"
heading: Speed–torque characteristics of shunt and series DC motors, a PM motor's efficiency curve and its peak, the electrical and mechanical step response by simulation, and the torque ripple of six-step brushless commutation
eyebrow: S12 · Lesson 36 · DC and PM motor lab
xp: 60
---

::: hook
DC and permanent-magnet motors are the easiest machines to model, which makes them the best place to see a machine's equations turn into behavior: a series motor's torque soaring as it slows, an efficiency curve with a sharp peak at a fraction of stall current, a speed that responds to a voltage step with the mechanical time constant, and a brushless motor whose torque ripples by 14% if its back-EMF is sinusoidal but its drive is six-step. You'll compute each and check it against lessons 31 to 33.
:::

::: play
- The curve is a PM motor's efficiency against its current, for the 24 V motor of lesson 32 (R = 0.5 Ω, no-load current on the slider): $\eta = (V - IR)(I - I_0)/(VI)$.
- Efficiency peaks at $\sqrt{I_0I_s}$, a small fraction of the 48 A stall current.
- Lower friction (smaller $I_0$) raises the peak and moves it to lower current.
:::

```sim plot
view: graph
x: I = 0.5..48
y: e = 0..1
slider: n = 0.1..2 = 0.4
plot: (24 - I*0.5)*(I - n)/(24*I) | label: efficiency
```

::: predict
## A 24 V PM motor with 0.5 Ω of resistance draws 0.4 A at no load. At what current is it most efficient?

- [ ] At half the 48 A stall current, where its power peaks
- [x] At about 4.4 A
- [ ] At 0.4 A
- [ ] At 48 A

::: reveal
Efficiency peaks where the copper loss, growing as $I^2$, balances the fixed friction loss: at $\sqrt{I_0I_s} = \sqrt{0.4 \times 48} = 4.38$ A, with 82.6% efficiency. Maximum power, at 24 A, comes at only 49% efficiency. Motors are chosen to run near their efficiency peak and sized so that peak power is a brief excursion.
:::
:::

::: nameit
## What the lab computes

- **Shunt motor** (constant flux): $I_a = T/K_a\Phi$ and $\omega = (V - I_aR_a)/K_a\Phi$.
- **Series motor** (unsaturated): $T = K'I^2$, so $I = \sqrt{T/K'}$ and $\omega = (V - IR)/(K'I)$.
- **PM efficiency**: with stall current $I_s = V/R$ and no-load current $I_0$ standing for friction, $\eta(I) = (V - IR)(I - I_0)/(VI)$, peaking at $\sqrt{I_0I_s}$ with $(1 - \sqrt{I_0/I_s})^2$.
- **Dynamics**: $L\,di/dt = V - Ri - k\omega$ and $J\,d\omega/dt = ki - T_L$. When L/R is much shorter than $JR/k^2$, the speed rises with the mechanical time constant.
- **Six-step torque**: the torque at angle θ is $\sum e_ki_k/\omega$; with 120° current blocks, a trapezoidal back-EMF gives constant torque, a sinusoidal one ripples between $\sqrt3\sin 60°$ and $\sqrt3$ (per unit EMF and current).
:::

::: check
kind: python

## Write `shunt_speed(V, k, Ra, T)` and `series_speed(V, R, K, T)`, each returning (current, speed in rpm).

```python starter
def shunt_speed(V, k, Ra, T):
    return 0.0, 0.0

def series_speed(V, R, K, T):
    return 0.0, 0.0
```

```python solution
import math

def shunt_speed(V, k, Ra, T):
    I = T / k
    return I, (V - I * Ra) / k * 60 / (2 * math.pi)

def series_speed(V, R, K, T):
    I = math.sqrt(T / K)
    return I, (V - I * R) / (K * I) * 60 / (2 * math.pi)
```

```python tests
import math
I, n = shunt_speed(240, 2.2, 0.2, 110)
assert abs(I - 50) < 1e-9 and abs(n - 998.3) < 0.1, "Lesson 31's shunt motor: 50 A, 998 rpm."
K = 228 / (40 * 1200 * 2 * math.pi / 60)
I2, n2 = series_speed(240, 0.3, K, K * 80 ** 2)
assert abs(I2 - 80) < 1e-9 and abs(n2 - 568.4) < 0.1, "The series motor at 80 A: 568 rpm."
I3, n3 = series_speed(240, 0.3, K, K * 20 ** 2)
assert n3 > 2 * 1200, "At a quarter of the torque it runs at over twice the speed."
```

::: right
Right. The shunt motor's speed barely moves with load; the series motor's swings widely, which suits traction and is dangerous unloaded.
:::
:::

::: check
kind: python

## Write `pm_efficiency(V, R, I0, I)` and `pm_peak(V, R, I0)` returning (current, efficiency) at the peak by the closed form.

```python starter
def pm_efficiency(V, R, I0, I):
    return 1.0

def pm_peak(V, R, I0):
    return 0.0, 1.0
```

```python solution
import math

def pm_efficiency(V, R, I0, I):
    return (V - I * R) * (I - I0) / (V * I)

def pm_peak(V, R, I0):
    Is = V / R
    return math.sqrt(I0 * Is), (1 - math.sqrt(I0 / Is)) ** 2
```

```python tests
I, e = pm_peak(24, 0.5, 0.4)
assert abs(I - 4.382) < 1e-3 and abs(e - 0.8258) < 1e-4, "The 24 V motor: 82.6% at 4.38 A."
assert all(pm_efficiency(24, 0.5, 0.4, I + d) <= e + 1e-12 for d in (-1, -0.01, 0.01, 1)), "It really is the peak."
assert abs(pm_efficiency(24, 0.5, 0.4, 24) - 0.4917) < 1e-4, "At maximum power, 24 A: only 49%."
```

::: right
Right. The peak is broad on the high-current side, so running a little above it costs little.
:::
:::

::: check
kind: python

## Write `pm_step(V, R, L, k, J, T, dt)`: simulate a PM motor (no load torque) from rest after a voltage step V, by RK4 on current and speed, returning the speeds; and `time_to_fraction(speeds, final, fraction, dt)`.

```python starter
def pm_step(V, R, L, k, J, T, dt):
    return [0.0]

def time_to_fraction(speeds, final, fraction, dt):
    return 0.0
```

```python solution
def pm_step(V, R, L, k, J, T, dt):
    def f(i, w):
        return (V - R * i - k * w) / L, k * i / J
    i = w = 0.0
    out = [0.0]
    for _ in range(int(round(T / dt))):
        a1, b1 = f(i, w)
        a2, b2 = f(i + dt / 2 * a1, w + dt / 2 * b1)
        a3, b3 = f(i + dt / 2 * a2, w + dt / 2 * b2)
        a4, b4 = f(i + dt * a3, w + dt * b3)
        i += dt / 6 * (a1 + 2 * a2 + 2 * a3 + a4)
        w += dt / 6 * (b1 + 2 * b2 + 2 * b3 + b4)
        out.append(w)
    return out

def time_to_fraction(speeds, final, fraction, dt):
    for n, w in enumerate(speeds):
        if w >= fraction * final:
            return n * dt
    return None
```

```python tests
sp = pm_step(24, 0.5, 1e-4, 0.05, 2e-5, 0.03, 1e-6)
assert abs(sp[-1] - 480) < 0.5, "It approaches the 480 rad/s no-load speed."
t = time_to_fraction(sp, 480, 1 - 2.718281828 ** -1, 1e-6)
assert abs(t - 0.0040) < 0.0001, "63% in about 4 ms: the mechanical time constant JR/k²."
sp2 = pm_step(24, 0.5, 4e-3, 0.05, 2e-5, 0.03, 1e-6)
assert max(sp2) > 480, "With L/R comparable to JR/k², the speed overshoots."
```

::: right
Right. When the electrical time constant isn't small, the motor is a second-order system and can ring.
:::
:::

::: check
kind: python

## Write `six_step_ripple(shape)`: for 120° current blocks centered on each phase's positive and negative back-EMF peaks, the torque's (max − min)/average over a revolution, with shape "sin" for a sinusoidal back-EMF or "trap" for one flat across 120° (rising linearly over 60° between).

```python starter
def six_step_ripple(shape):
    return 0.0
```

```python solution
import math

def emf(x, shape):
    if shape == "sin":
        return math.sin(x)
    x %= 2 * math.pi
    s = math.pi / 6
    if x < s:
        return x / s
    if x < 5 * s:
        return 1.0
    if x < 7 * s:
        return 1 - (x - 5 * s) / s
    if x < 11 * s:
        return -1.0
    return -1 + (x - 11 * s) / s

def block(x):
    x %= 2 * math.pi
    if math.pi / 6 < x < 5 * math.pi / 6:
        return 1
    if 7 * math.pi / 6 < x < 11 * math.pi / 6:
        return -1
    return 0

def six_step_ripple(shape):
    vals = []
    for n in range(3600):
        th = 2 * math.pi * (n + 0.5) / 3600
        vals.append(sum(emf(th - k * 2 * math.pi / 3, shape) * block(th - k * 2 * math.pi / 3) for k in range(3)))
    avg = sum(vals) / len(vals)
    return (max(vals) - min(vals)) / avg
```

```python tests
assert abs(six_step_ripple("sin") - 0.140) < 0.002, "Sinusoidal back-EMF: 14% ripple."
assert six_step_ripple("trap") < 1e-9, "Trapezoidal back-EMF: none."
```

::: right
Right. Six-step drives suit trapezoidal motors; sinusoidal motors want sinusoidal currents.
:::
:::

::: explain
## Why does a PM motor's efficiency peak at a current far below the current for maximum power?

::: model
Two losses compete. Friction and core loss, represented by the no-load current, take a roughly fixed power, so at light loads they are a large share of a small output. Copper loss grows as the square of the current, so at heavy loads it dominates, and at the maximum-power point, half the stall current, half of the electrical input is burned in the winding. Efficiency peaks between, where the two losses are comparable, which for a good motor is a small fraction of stall current: the geometric mean of the no-load and stall currents.
:::
:::
