# 00 | Course architecture

**AI disclosure:** This course was fully AI-generated. Its numbers come from the course's own models, which are listed in chapter 20 with their limits.

This course teaches how permanent-magnet brushless motors produce torque and how electronics drive them: the motor's constants and losses, the three-phase inverter, six-step commutation with Hall sensors and without them, field-oriented control (FOC), modulation, current and position sensing, field weakening, braking, protection and bench identification. It is written for an electronics graduate comfortable with phasors and basic feedback. Allow roughly **52–73 hours** plus bench time; chapter 21 is an extension on fault transients.

## The E1 design thread

One motor runs through every chapter: **E1, a 24 V, four-pole-pair surface-magnet motor** of about 100 W. Its parameters are typical of small industrial or hobby motors and are chosen to make every limit visible:

| Parameter | E1 value | Notes |
|---|---|---|
| DC link | 24 V, 470 µF | From a supply that cannot absorb returned energy |
| Pole pairs \(p\) | 4 | Electrical frequency is 4 × mechanical |
| Phase resistance \(R\) | 0.25 Ω (0.5 Ω line to line) | Star connection |
| Phase inductance \(L\) | 0.4 mH (0.8 mH line to line) | Surface magnets: \(L_d=L_q\) |
| Magnet flux linkage \(\psi\) | 7.5 mWb, phase peak | Amplitude-invariant convention |
| Current limit | 8 A phase peak | Inverter and thermal limit |
| Inertia \(J\) | 50 × 10⁻⁶ kg·m² | Rotor plus a small load |

<figure><img src="figures/e1-drive.svg" alt="Block diagram: 24 V supply, DC-link capacitor, brake chopper, three-phase inverter and E1 motor; gate driver; MCU with three-phase timer, ADC and break input; Hall, encoder or observer feeding the angle back."><figcaption>Figure 1. The E1 drive. Energy flows left to right in motoring and right to left when braking; the supply cannot accept it.</figcaption></figure>

The controller is any microcontroller with a three-phase PWM timer (complementary outputs, dead time, a hardware break input) and an ADC that the timer can trigger. That describes many small parts, including CH32V-class devices; the course does not assume a particular one. Write down the exact timer and ADC features of your part before designing the firmware.

| Evidence | What it is | What it can establish |
|---|---|---|
| Teaching model | The course's equations and tools | Mechanisms, limits and orders of magnitude |
| Datasheet design | A specific motor, inverter and controller on paper | That the parts are plausible with margins |
| Measured drive | Identified parameters, currents, temperatures and fault tests | The behaviour of one drive under stated conditions |

## How to study

Each chapter gives theory, a worked E1 example and an exercise with a worked answer or review criteria. Predict before you calculate and calculate before you open a tool. Record reasoning in the chapter notebook (stored locally; export to keep it).

| Study block | Produce before moving on | Self-check |
|---|---|---|
| Chapters 0–3 | Motor constants in consistent units and a speed–torque sketch | Can you convert Kv to Kt and say which current the Kt refers to? |
| Chapters 4–7 | Commutation table, current loop and a sensorless start plan | Which phase floats in each Hall state, and why? |
| Chapters 8–13 | dq model, tuned current and speed loops, sensing timeline | What limits the current-loop bandwidth on E1? |
| Chapters 14–18 | Operating envelope, braking plan, fault table, bring-up plan | What happens to the bus when you stop the motor in 50 ms? |

**Safety boundary.** Motors store kinetic energy, generate voltage when turned and can move suddenly. Bench work uses a current-limited supply, a mechanically secured motor, guards and a plan for returned energy (chapter 15). No exercise requires running hardware.

**Deliverable 0:** write a notebook entry with your motor (or E1), supply, the sensors available, the instruments you have (current probe, oscilloscope, tachometer) and the three topics you trust yourself least to judge.

# 01 | Electromagnetic basics and motor constants

A permanent-magnet motor converts current into torque and speed into voltage through the same constant. Getting that constant and its units right removes most beginner errors.

## Force, torque and back-EMF

A conductor of length \(\ell\) carrying current \(I\) in a field \(B\) feels a force \(F=BI\ell\); the same conductor moving at velocity \(v\) has a voltage \(e=B\ell v\) induced in it. Summed over a winding, these become

\[
T=K_t\,I,\qquad e=K_e\,\omega,\qquad K_t=K_e\ \ \text{(SI units: N·m/A = V·s/rad)}.
\]

The equality is energy conservation: electrical power \(eI\) converted equals mechanical power \(T\omega\). It holds only when both constants use the same current and voltage definitions.

## Electrical and mechanical angle

A motor with \(p\) pole pairs passes through \(p\) electrical cycles per mechanical revolution: \(\theta_e=p\theta_m\), \(\omega_e=p\omega_m\). E1 at 3000 rpm turns at \(\omega_m=314\) rad/s (50 rev/s), so its electrical frequency is 200 Hz. All commutation and control angles in this course are electrical unless stated.

## The flux-linkage description

For a sinusoidal machine, the magnet's flux linkage \(\psi\) (peak per phase) gives the phase back-EMF amplitude directly: \(e_{pk}=\psi\omega_e\). E1 at 3000 rpm: \(\omega_e=1257\) rad/s, so \(e_{pk}=9.4\) V per phase, 16.3 V peak and 11.5 V RMS line to line. In the field-oriented model (chapter 8), torque is

\[
T=\tfrac32\,p\,\psi\,i_q,
\]

which for E1 is 0.045 N·m per ampere of phase peak current, or 0.064 N·m per ampere RMS.

## Kv, Kt and the traps

Hobby motors are sold by **Kv**, the no-load speed per volt of DC supply in a six-step drive. Chapter 2 shows that a six-step drive behaves like a DC motor with constant

\[
K_6=\frac{3\sqrt3}{\pi}\,\psi\,p\approx1.654\,\psi\,p,
\]

the average line-to-line back-EMF over each 60° commutation interval per mechanical rad/s. For E1, \(K_6=0.0496\) V·s/rad, so \(Kv=60/(2\pi K_6)=192\) rpm/V and the torque constant is 0.0496 N·m per ampere in the conducting phase pair, the familiar \(K_t\approx9.55/Kv\). Three different “torque constants” therefore describe the same motor: 0.0496 per conducting-pair ampere (six-step), 0.045 per phase-peak ampere and 0.064 per phase-RMS ampere (sinusoidal). Datasheets also quote line-to-line or phase values, peak or RMS, and sometimes rpm instead of rad/s. Always write the definition next to the number. With PWM and continuous pair current, the average source current is approximately \(I_{dc}=dI\), where \(I\) is the conducting-pair current and \(d\) is duty. They coincide at full duty; torque per average source ampere is not a duty-independent motor constant.

### Exercise 1 · Convert a datasheet

A datasheet gives “Kv = 192 rpm/V, R = 0.5 Ω line to line, 4 pole pairs”. Estimate \(\psi\), the phase back-EMF at 3000 rpm, the torque per phase-peak ampere under FOC and the electrical frequency at 4000 rpm.

<details><summary>Worked solution</summary>
<p>\(K_6=60/(2\pi\times192)=0.0497\) V·s/rad; \(\psi=K_6/(1.654\,p)=0.0497/6.62=7.5\) mWb. At 3000 rpm, \(\omega_e=4\times314=1257\) rad/s and \(e_{pk}=9.4\) V per phase. Torque per phase-peak ampere is \(1.5\times4\times0.0075=0.045\) N·m/A. At 4000 rpm the electrical frequency is \(4000/60\times4=267\) Hz. The conversion assumes a sinusoidal back-EMF and a Kv measured with six-step drive; confirm by spinning the motor and measuring (chapter 17).</p>
</details>

# 02 | The equivalent circuit and the speed–torque line

In steady state a six-step drive looks like a DC motor: two phases in series, energised in turn so that they always see a nearly constant back-EMF. That model answers most first questions about speed, torque, current and heat.

## The DC-motor equivalent

With duty \(d\) applied to the DC link, line-to-line resistance \(R_{LL}\) and constant \(K\):

\[
dV_{dc}=K\omega+R_{LL}I,\qquad T=KI-T_f.
\]

At full duty, speed falls linearly with torque from the no-load speed \(\omega_0\approx V_{dc}/K\) to the stall torque \(KV_{dc}/R_{LL}\). For E1 (\(K=0.0496\), \(R_{LL}=0.5\) Ω, 24 V) the no-load speed is about 4610 rpm and the stall current would be 48 A: six times the current limit. The drive's current limit flattens the torque at 0.39 N·m below about 3850 rpm; above that, the motor runs on the voltage-limited line.

## Power and efficiency

Output power \(T\omega\) peaks at half the no-load speed on the voltage line, \(V_{dc}^2/(4R_{LL})=288\) W for E1, but only at 24 A. With the 8 A limit the peak is about 158 W at the corner near 3850 rpm. Copper loss is \(I^2R_{LL}\); with only copper and a small friction torque, Laboratory 1 finds the best efficiency (about 91%) near 4400 rpm at light load. Real motors add iron loss that grows with speed and inverter loss, which pull the peak lower.

## Continuous and peak ratings

Peak torque is a current (and magnet demagnetisation) limit. Continuous torque is a thermal limit: the copper loss the motor can shed. If E1 can dissipate 12 W continuously in its windings, the continuous current is \(\sqrt{12/0.5}=4.9\) A in six-step and the continuous torque about 0.24 N·m. Winding resistance rises about 0.4% per kelvin, so a hot motor has less torque per watt of heat.

## Inductance and the electrical time constant

The line-to-line inductance (0.8 mH) and resistance give an electrical time constant \(L/R=1.6\) ms. At 3000 rpm each six-step interval lasts 0.83 ms, shorter than that time constant, which is why current takes a visible fraction of each interval to transfer between phases (chapter 5) and why the current loop must be designed (chapter 6).

### Exercise 2 · Size a duty point

E1 must deliver 0.2 N·m at 3500 rpm from 24 V. Find the current, the voltage the inverter must supply, the duty, the copper loss and the efficiency with copper and 0.005 N·m friction only. Is it a continuous operating point?

<details><summary>Worked solution</summary>
<p>\(I=(0.2+0.005)/0.0496=4.13\) A. Back-EMF \(K\omega=0.0496\times366.5=18.2\) V; resistive drop \(4.13\times0.5=2.07\) V; total 20.2 V, duty 0.84. Copper loss 8.5 W; output power \(0.2\times366.5=73.3\) W; efficiency about \(73.3/(73.3+8.5+0.005\times366.5)\approx88\%\). With 12 W allowed copper loss it is continuous, with the iron loss still to check.</p>
</details>

<div class="tool-slot" data-tool="motor"></div>

# 03 | Construction, windings and back-EMF shape

Mechanical construction sets the motor's constants, its back-EMF shape and the control that suits it.

## Rotor and stator

**Inrunners** put the magnets on an inner rotor: low inertia, high speed. **Outrunners** put them on an outer bell: more magnet area and torque per size, more inertia. Stators carry slots with concentrated windings (each coil around one tooth), common in small motors because they are short and cheap to wind. The slot and pole numbers (for example 12 slots, 8 poles for E1's four pole pairs) set the winding factor and the cogging torque.

## Back-EMF shape: BLDC and PMSM

Magnet shape, magnetisation and winding distribution decide whether the back-EMF is trapezoidal or sinusoidal. A **BLDC** motor in the strict sense has a trapezoidal back-EMF with flat tops of 120° electrical; it suits six-step drive with rectangular currents. A **PMSM** has a sinusoidal back-EMF and suits sinusoidal currents, usually via FOC. Most small motors are somewhere in between. Six-step on a sinusoidal motor works but produces torque ripple; FOC on a trapezoidal motor works but leaves some torque unused. Spin the motor and look at its line-to-line voltage before choosing.

## Star and delta

In **star**, phase current equals line current and the line-to-line voltage is \(\sqrt3\) times the phase voltage for sinusoids. In **delta**, the phase sees the full line voltage and carries \(1/\sqrt3\) of the line current. A delta winding with a third-harmonic back-EMF component carries circulating current inside the delta even with no load, adding loss. Measure line-to-line quantities and convert carefully; a star-equivalent model works for both if you use it consistently.

## Surface and interior magnets

In a surface-magnet machine (SPM) the magnets sit in the air gap, so the inductance is the same in every rotor direction: \(L_d=L_q\). In an interior-magnet machine (IPM) the magnets are buried, iron paths differ along and across the magnet axis, and typically \(L_q>L_d\). That saliency adds reluctance torque \(\tfrac32p(L_d-L_q)i_di_q\) and makes the rotor position detectable at standstill by injecting high-frequency voltage (chapter 12). E1 is an SPM.

## Cogging and torque ripple

Even unpowered, magnets prefer certain positions relative to the teeth: cogging torque. Its period depends on the least common multiple of slots and poles. Cogging, back-EMF harmonics and current harmonics all produce torque ripple, felt as vibration and noise at low speed. Control can reduce the last two; the first is mechanical.

### Exercise 3 · Classify a motor from its waveform

You spin an unknown motor at a constant speed and see a line-to-line voltage with flat-topped peaks, frequency 140 Hz at 1050 rpm and amplitude 9 V. Determine the pole pairs, describe the likely back-EMF shape and suggest the first control scheme to try.

<details><summary>Worked solution</summary>
<p>1050 rpm is 17.5 rev/s, so \(p=140/17.5=8\) pole pairs. Flat-topped line-to-line voltage suggests a trapezoidal back-EMF, so six-step commutation is a natural start. A flat top on the line voltage can also come from a slightly trapezoidal phase EMF; view one phase against a virtual neutral (three equal resistors) to confirm before deciding between six-step and FOC.</p>
</details>

# 04 | The three-phase inverter

Three half-bridges connect each motor terminal to either DC rail. Every drive in this course, six-step or FOC, uses the same power stage.

<figure><img src="figures/inverter.svg" alt="Three half-bridges of N-MOSFETs between the DC rail and ground, each low-side source returning through a shunt resistor; the midpoints A, B and C go to the star-connected windings; a DC-link capacitor across the rails."><figcaption>Figure 2. The three-phase inverter with low-side shunts. Each midpoint can be high, low or (both switches off) floating.</figcaption></figure>

## Switch states and current paths

Each leg has three useful states: high-side on, low-side on, or both off. Both on is a shoot-through short across the DC link, which dead time prevents. With both off, the motor current continues through a body diode: from the motor terminal through the upper diode into the positive rail for current entering the inverter, or from the negative rail through the lower diode into the motor for the opposite direction. That freewheel path matters for commutation, braking and faults.

## Choosing MOSFETs

Voltage rating covers the DC link plus braking overshoot and switching spikes; a 24 V drive usually uses 40–60 V devices. Current rating is thermal: in sinusoidal operation each device conducts about half of each electrical period, so conduction loss per device is roughly \(\tfrac12I_{rms}^2R_{DS(on)}\). For E1 at 8 A peak (5.7 A RMS) and 5 mΩ hot, that is about 80 mW per device before switching loss, small; the heat in a small drive is often in the shunts, the motor and the copper.

## Gate drive and bootstrap

High-side N-MOSFETs need a floating gate supply, usually a bootstrap capacitor charged whenever the low-side switch of the same leg conducts (the [buck course](https://psym.pl/buck-course/#ch07) derives it). Six-step schemes that hold a high-side switch on for a whole 120° interval need a bootstrap large enough to last that long, or a charge pump. At 300 rpm E1's 60° commutation interval is 8.3 ms, but one high-side device can remain on for 120°, or **16.7 ms**; a few microamperes of gate leakage plus the driver's quiescent current then matter. Continuous centre-aligned FOC PWM can refresh every leg each period only when every leg has sufficient low-side on-time. At maximum modulation, with clamped/discontinuous modulation or during startup, check the actual longest interval without recharge. [Infineon’s bootstrap guidance](https://community.infineon.com/t5/Knowledge-Base-Articles/How-to-calculate-the-bootstrap-capacitor-for-SVPWM-modulation-scheme-in-CIPOS/ta-p/1107844) discusses this dependence on modulation and operating point.

## Dead time

Dead time (both switches off) must exceed the worst turn-off delay. During it the phase voltage is set by the current's direction, not the PWM command, so the applied voltage errs by about \(V_{dc}t_df_{pwm}\) with the sign of the current. At 24 V, 500 ns and 20 kHz that is 0.24 V per phase, small at speed but a large fraction of the 0.94 V back-EMF at 300 rpm (chapter 10).

## The DC-link capacitor

The inverter draws pulsed current from the DC link. The capacitor supplies its AC part. Kolar and Round's analytical result for sinusoidal PWM gives the capacitor RMS current in terms of the phase RMS current, modulation index \(M\) (phase peak over \(V_{dc}/2\)) and power factor:

\[
I_{C,rms}=I_{ph,rms}\sqrt{2M\left[\frac{\sqrt3}{4\pi}+\cos^2\varphi\left(\frac{\sqrt3}{\pi}-\frac{9M}{16}\right)\right]}.
\]

Its worst case is about \(0.65I_{ph,rms}\). For E1 at 3000 rpm under load (\(M\approx0.89\), \(\cos\varphi\approx0.95\), 3.5 A RMS) it is about 2.0 A. Size the capacitor's ripple rating and ESR heating for the worst operating point, and place ceramics directly at each leg for the switching edges.

### Exercise 4 · Rate E1's power stage

Choose voltage and RDS(on) targets for E1's MOSFETs, estimate conduction loss at 8 A peak and the DC-link capacitor ripple current at the worst case, and list what you would check in the gate driver datasheet.

<details><summary>Worked solution</summary>
<p>Voltage: 40 V minimum, 60 V if braking can lift the bus above 30 V before the chopper acts. With 5 mΩ hot, conduction loss is about 80 mW per device at 8 A peak. Worst-case capacitor ripple \(\approx0.65\times5.7=3.7\) A RMS; two 220 µF low-ESR parts plus ceramics per leg is a reasonable start. Gate driver: supply range and UVLO, bootstrap diode and its reverse voltage, negative switch-node tolerance, propagation delay and matching (sets the dead time), shoot-through interlock, and the behaviour of its enable/fault pin.</p>
</details>

# 05 | Six-step commutation with Hall sensors

Six-step (trapezoidal) commutation energises two phases at a time and switches pairs every 60° electrical, using three Hall sensors to know when.

<figure><img src="figures/hall-sequence.svg" alt="Three Hall signals offset by 120 degrees over one electrical revolution, giving six states; under each state the energised pair, from A+B− to C+B−, with the Hall code."><figcaption>Figure 3. One common Hall and commutation convention. The angle origin here is a Hall edge, 30° after the phase-A back-EMF zero crossing; the energised pair is the one whose back-EMFs are flat and opposite.</figcaption></figure>

## The commutation table

Three Hall sensors spaced 120° electrical give six distinct codes per electrical revolution (000 and 111 never occur; seeing them means a sensor fault). Each code selects one phase to connect high, one low and one to leave floating. The table is fixed by the Hall placement and the winding order, so it must be established for each motor: a wrong row produces weak torque, current spikes or reverse rotation.

## Why the pairs line up with the back-EMF

Torque is \(\sum e_ki_k/\omega\). With a trapezoidal back-EMF, each phase is flat for 120°. Energising the two phases whose back-EMFs are on opposite flat tops gives \(e_ai_a+e_bi_b=2EI\), constant over the interval: ideal, ripple-free torque. The Hall sensors are placed so that their edges fall at the ends of these intervals. With a sinusoidal back-EMF, the sum varies with \(\cos\) over each 60° interval. Laboratory 2 shows a minimum-to-maximum ripple of 14% of the average (\(1-\cos30°=13.4\%\) of the peak), the price of six-step on a sinusoidal motor.

## Advance and Hall errors

Commutating early by 15° reduces average torque by about 3% on the sinusoidal motor and raises ripple to about 32%; it can help at high speed because it compensates the time the current needs to transfer (chapter 2's time constant). A Hall sensor misplaced by 10° shifts all commutation points: average torque falls by about 1.5% and the ripple grows to about 25%. Uneven Hall spacing produces a ripple that repeats every revolution; you hear it.

## PWM in six-step

Speed or current is controlled by PWM within each interval. Common choices: chop only the high-side switch (the low side stays on), chop only the low side, or chop the pair complementarily (synchronous rectification). They differ in freewheel paths, losses and current measurement. During the off-time of a chopped high side, the current freewheels through the other low-side switch and its own leg's low-side body diode (or switch); the floating phase must stay floating, or the drive loses the sensorless zero crossing of chapter 7.

## Commutation current

When the drive switches from A+B− to A+C−, current in B must fall to zero while C's rises. B's current decays through a body diode against the bus voltage, C's rises against \(V_{dc}-e\). Their rates differ, and the sum flowing in A dips or bumps. This commutation ripple grows with speed and inductance and is a second source of six-step torque ripple.

### Exercise 5 · Build and test a commutation table

Using Figure 3 and Laboratory 2, write the six-row table (Hall code → high phase, low phase, floating phase). Then predict the torque ripple for a sinusoidal motor with 0° and 15° advance, and check with the tool.

<details><summary>Worked solution</summary>
<p>Codes 5, 1, 3, 2, 6, 4 select A+B−, A+C−, B+C−, B+A−, C+A−, C+B−; the floating phase is the remaining one (C, B, A, C, B, A). Sinusoidal motor: about 14% ripple with no advance; with 15° advance about 32% and 3.5% less average torque. On a trapezoidal motor the ideal ripple is zero with no advance and about 26% with 15° of advance. Real ripple adds the commutation dips that the ideal tool omits.</p>
</details>

<div class="tool-slot" data-tool="sixstep"></div>

# 06 | Current control in a six-step drive

Torque follows current, so a good drive controls current directly and wraps a speed loop around it.

## Measuring the current

In six-step, one high-side and one low-side switch conduct during the on-time, so the current through a single shunt in the DC-link return (or in the active low-side leg) is the motor current. Sample it in the middle of the on-time, after switching noise has settled. During the off-time, the freewheeling current bypasses a DC-link shunt, so the signal disappears; this is why the sample must be synchronised with the PWM.

## The plant

Over a few PWM periods the energised pair is a series R–L circuit with a slowly varying back-EMF:

\[
\frac{I(s)}{V(s)}=\frac{1}{R_{LL}+sL_{LL}},\qquad \tau=\frac{L_{LL}}{R_{LL}}.
\]

The back-EMF changes slowly compared with the current loop, so it is a disturbance that a PI controller's integrator removes; feeding it forward (\(K\omega\)) helps the loop at speed.

## Tuning by pole–zero cancellation

Choosing the PI zero at the plant pole leaves an integrator in the loop:

\[
K_p=2\pi f_cL_{LL},\qquad K_i=K_p\frac{R_{LL}}{L_{LL}},\qquad T(s)=\frac{2\pi f_c}{s}e^{-sT_d}.
\]

With a digital controller the delay \(T_d\) is about 1.5 PWM periods (one for computation and update, half for the PWM hold). The phase margin is then \(90°-360°f_cT_d\). At 20 kHz, \(T_d=75\) µs, so a 1 kHz crossover keeps 63° of margin, 2 kHz only 36°, and 4 kHz is unstable. For E1, \(K_p=5.0\) V/A and \(K_i=3140\) V/(A·s) at 1 kHz; the step response reaches 90% in about 0.3 ms without overshoot (Laboratory 3). In practice a 5 A step briefly saturates the 24 V available, which the conditional anti-windup handles.

## Cycle-by-cycle limit as a backstop

A comparator on the shunt that ends the PWM pulse when current exceeds a threshold protects the switches regardless of firmware. Its threshold sits above the regulated maximum with margin for ripple and noise. The [buck course's](https://psym.pl/buck-course/#ch13) current-runaway analysis applies when the motor is stalled with a short off-time: check that each minimum pulse adds less current than the off-time removes.

### Exercise 6 · Tune E1's six-step current loop

With Laboratory 3, compare crossovers of 500 Hz, 1 kHz and 2 kHz at 20 kHz PWM, and then 1 kHz at 10 kHz PWM. Report Kp, Ki, the margin estimate, overshoot and time to 90%. Which would you choose, and what limits it?

<details><summary>Worked solution</summary>
<p>At 20 kHz: 500 Hz gives Kp ≈ 2.5 V/A, about 76° and a slower step; 1 kHz gives about 63° with no overshoot; 2 kHz gives about 36° and about 16% overshoot. At 10 kHz PWM the delay doubles to 150 µs, so a 1 kHz crossover keeps only about 36°. Choose 1 kHz at 20 kHz. The limit is the sampling and update delay, not the motor; a faster loop needs a higher PWM and control rate or less computational delay.</p>
</details>

<div class="tool-slot" data-tool="currentloop"></div>

# 07 | Sensorless six-step: back-EMF zero crossings

Hall sensors cost wires, space and a failure mode. In six-step drive one phase floats in every interval, and its terminal voltage reveals the rotor position.

## The zero crossing

In each interval the floating phase's back-EMF passes through zero, halfway through its sloped transition. Measured against the motor's neutral, the floating terminal voltage equals that back-EMF (plus the neutral's shift), so its zero crossing marks a known rotor position: 30° electrical before the next commutation. The controller detects the crossing, waits half an interval (30°) using the measured interval length, and commutates. A comparator against a **virtual neutral** (three equal resistors from the terminals) or ADC samples synchronised with the PWM implement it.

## Timing at E1's speeds

At 3000 rpm the electrical period is 5 ms, each interval 833 µs and the 30° delay 417 µs. At 300 rpm the back-EMF peak is only 0.94 V per phase; detecting its zero crossing against PWM noise, comparator offset and the neutral's PWM-frequency swing is hard. Every sensorless six-step drive has a minimum speed, often 5–10% of rated, below which it cannot see the rotor.

## Demagnetisation and blanking

After each commutation, the phase that has just been switched off still carries current. Until it decays, the current flows through a body diode, clamping the floating terminal to a rail and hiding the back-EMF. The decay takes roughly \(L_{LL}I/V_{dc}\): about 0.17 ms for E1 at 5 A, a fifth of an interval at 3000 rpm. The detector must ignore the floating phase during that time. At high current and speed the demagnetisation can consume so much of the interval that the zero crossing is missed, and the drive loses synchronism.

## Starting without position

At standstill there is no back-EMF. The usual sequence is:

1. **Align:** drive a fixed current into one pair so the rotor turns to a known position. Limit the current; the rotor may swing.
2. **Open-loop ramp:** commutate on a timer with increasing frequency and controlled current, like a stepper.
3. **Handover:** once the back-EMF is large enough and the detected crossings agree with the forced timing, switch to closed-loop commutation.

The ramp must accelerate the load: too fast and the rotor falls out of step, too slow and the back-EMF never becomes usable. Loads with unknown friction or inertia make startup the hardest part of sensorless six-step. Microchip's [AN1160](https://ww1.microchip.com/downloads/en/AppNotes/01160b.pdf) describes a robust zero-crossing filter.

### Exercise 7 · Plan E1's sensorless start

Design an align–ramp–handover sequence for E1 with a 0.02 N·m friction load. Choose the alignment current, the ramp end speed and acceleration, and the handover criterion. Estimate the back-EMF at the handover speed and the demagnetisation time at the ramp current.

<details><summary>Worked solution</summary>
<p>Align with about 2 A for 100–200 ms (well below the 8 A limit; enough to overcome cogging and friction). Ramp to about 400 rpm (back-EMF ≈ 1.3 V per phase peak), at an acceleration the available torque can produce with margin: with 3 A (≈ 0.15 N·m) and 0.02 N·m friction, \(\alpha\approx(0.15-0.02)/50\times10^{-6}\approx2600\) rad/s², so 400 rpm (42 rad/s) takes about 16 ms; use several times longer for margin, for example 100 ms. Hand over after several consecutive detected crossings fall within ±15° of the forced timing. Demagnetisation at 3 A: about \(0.8\,\text{mH}\times3/24\approx0.1\) ms, a small fraction of the 6.25 ms interval at 400 rpm (electrical period 37.5 ms).</p>
</details>

# 08 | Reference frames: Clarke, Park and the dq model

Field-oriented control rests on one idea: in a frame that rotates with the rotor, sinusoidal phase quantities become constants, and a three-phase motor looks like two DC motors.

<figure><img src="figures/dq-frames.svg" alt="Phase axes a, b and c at 0, 120 and 240 degrees; the stationary alpha–beta frame; the rotating d axis aligned with the magnet flux at angle theta e and the q axis 90 degrees ahead; a current space vector with its d and q projections."><figcaption>Figure 4. The current space vector seen from the stationary αβ frame and from the rotor's dq frame. Torque comes from the q component.</figcaption></figure>

## Space vectors and the Clarke transform

Three phase currents with \(i_a+i_b+i_c=0\) carry only two independent quantities. The amplitude-invariant **Clarke** transform maps them onto a stationary orthogonal pair:

\[
i_\alpha=\tfrac23\left(i_a-\tfrac12i_b-\tfrac12i_c\right)=i_a,\qquad i_\beta=\frac{i_b-i_c}{\sqrt3}.
\]

For balanced sinusoids of amplitude \(I\), \((i_\alpha,i_\beta)\) is a vector of length \(I\) rotating at \(\omega_e\). With two measured phases, \(i_c=-i_a-i_b\).

## The Park transform

Rotating that vector backwards by the electrical rotor angle \(\theta_e\) gives the **dq** components:

\[
i_d=i_\alpha\cos\theta_e+i_\beta\sin\theta_e,\qquad i_q=-i_\alpha\sin\theta_e+i_\beta\cos\theta_e.
\]

The d axis is aligned with the magnet's flux, the q axis 90° ahead. In steady state at constant speed and load, \(i_d\) and \(i_q\) are constants. The inverse transforms go back to phase voltages for the inverter.

## The PMSM in dq

For a machine with inductances \(L_d\), \(L_q\), resistance \(R\) and magnet flux \(\psi\):

\[
v_d=Ri_d+L_d\frac{di_d}{dt}-\omega_eL_qi_q,\qquad
v_q=Ri_q+L_q\frac{di_q}{dt}+\omega_e(L_di_d+\psi),
\]

\[
T=\tfrac32p\left[\psi i_q+(L_d-L_q)i_di_q\right],\qquad P_{elec}=\tfrac32(v_di_d+v_qi_q).
\]

The \(\tfrac32\) factors come from the amplitude-invariant convention: the dq quantities have the length of the phase peak, while power is shared among three phases. The \(\omega_e\) terms couple the axes and carry the back-EMF \(\omega_e\psi\) on the q axis. For a surface-magnet motor (\(L_d=L_q\)) only \(i_q\) makes torque, and the best efficiency below base speed is \(i_d=0\).

## E1 in steady state

At 3000 rpm and \(i_q=5\) A (0.225 N·m): \(v_q=0.25\times5+1257\times0.0075=10.7\) V, \(v_d=-1257\times0.4\,\text{mH}\times5=-2.5\) V, so the voltage vector is 11.0 V. The SVPWM limit at 24 V is \(24/\sqrt3=13.9\) V (chapter 10). At 4000 rpm the same current needs 14.2 V: E1 cannot carry rated torque there without field weakening (chapter 14).

### Exercise 8 · Transform by hand

At \(\theta_e=30°\), \(i_a=4.33\) A, \(i_b=0.67\) A and \(i_c=-5.0\) A. Compute \(i_\alpha\), \(i_\beta\), \(i_d\), \(i_q\) and the torque for E1. Then explain what an angle error of +10° in \(\theta_e\) would make the controller believe.

<details><summary>Worked solution</summary>
<p>\(i_\alpha=4.33\) A, \(i_\beta=(0.67+5.0)/\sqrt3=3.27\) A. \(i_d=4.33\cos30°+3.27\sin30°=3.75+1.64=5.39\) A; \(i_q=-4.33\sin30°+3.27\cos30°=-2.17+2.83=0.67\) A. The current vector (5.43 A at 37°) lies almost on the d axis, so torque is only \(0.045\times0.67=0.03\) N·m: a mis-aligned current. With a +10° angle error the controller rotates by 40° instead and computes \(i_d\approx5.42\) A and \(i_q\approx-0.28\) A: it sees the vector 10° further round, so it would add q-axis current that the rotor does not use as intended. Angle errors waste current and torque (chapter 12).</p>
</details>

# 09 | Field-oriented control

FOC regulates \(i_d\) and \(i_q\) with two PI controllers in the rotor frame, converts their voltage commands back to the stator and modulates them. A speed loop sets \(i_q^*\).

<figure><img src="figures/foc-blocks.svg" alt="FOC block diagram: speed reference and speed PI produce iq reference; id reference; two current PIs produce vd and vq; inverse Park with voltage limit; SVPWM; inverter and motor; measured currents through Clarke and Park back to the summing junctions; angle and speed from a sensor or observer."><figcaption>Figure 5. Field-oriented control. Every block between the measured currents and the PWM runs once per control period.</figcaption></figure>

## Current loops in dq

Each axis is the same R–L plant as chapter 6, with phase values: \(1/(R+sL)\), time constant 1.6 ms for E1. Pole–zero cancellation gives \(K_p=2\pi f_cL\) and \(K_i=K_pR/L\): for a 1 kHz crossover, 2.51 V/A and 1570 V/(A·s). The 1.5-period delay at 20 kHz leaves about 63° of margin, as before.

## Decoupling

The cross-terms \(-\omega_eLi_q\) and \(\omega_e(Li_d+\psi)\) appear in the plant as disturbances that grow with speed. Adding them as feed-forward to the PI outputs cancels them, so each axis again looks like a simple R–L load. At E1's speeds the cross-coupling is a few volts (2.5 V at 3000 rpm and 5 A) and the integrators remove it anyway; feed-forward matters more at high speed, high inductance or during fast transients. The back-EMF feed-forward \(\omega_e\psi\) on the q axis is the most useful single term.

## The voltage limit

The inverter can produce at most \(V_{dc}/\sqrt3\) of phase-peak voltage in the linear SVPWM range. The controller limits the voltage vector, typically giving the d axis priority (it controls flux and stability) and the q axis the remainder. When the limit is active, the q-axis integrator must stop integrating (anti-windup), or it winds up and causes overshoot when the limit releases.

## The speed loop

The mechanical plant from \(i_q\) to speed is an integrator, \(\omega_m=K_ti_q/(Js)\) with \(K_t=\tfrac32p\psi\). A PI with crossover \(f_{cw}\) gets \(K_p=2\pi f_{cw}J/K_t\), with its zero a factor of four below crossover for margin. For E1 at 50 Hz: \(K_p=0.35\) A·s/rad and \(K_i=27\) A/rad. The speed loop must be several times slower than the current loop (here 20×) so the current loop looks ideal to it. Its output is limited to the current limit; anti-windup again.

## What Laboratory 4 shows

A step from standstill to 3000 rpm saturates \(i_q\) at 8 A, so the motor accelerates at its maximum torque (0.36 N·m, 7200 rad/s²) and reaches 90% speed in about 40 ms. A 0.15 N·m load step at 150 ms causes a 68 rpm dip; raising the speed crossover to 150 Hz cuts it to about 24 rpm. Asking for 4300 rpm without field weakening fails: the voltage limit stops the q current and the motor settles near 3860 rpm under the load. With \(i_d=-4\) A it reaches 4300 rpm. Switching decoupling off barely changes these results at E1's speeds, which is itself a useful measurement.

### Exercise 9 · Tune and stress E1's FOC

With Laboratory 4, (a) find the speed-loop crossover that keeps the dip after a 0.15 N·m step below 30 rpm; (b) find the smallest \(|i_d|\) that lets E1 hold 4300 rpm with the load; (c) explain why the speed loop cannot simply be made as fast as the current loop.

<details><summary>Worked solution</summary>
<p>(a) About 120 Hz (29 rpm; 100 Hz gives 35 rpm and 150 Hz 24 rpm). (b) Decreasing \(i_d\) from 0: −2 A reaches about 4265 rpm and −2.5 A holds 4300 rpm with 0.15 N·m. Every ampere of \(i_d\) takes current from the limit and adds copper loss without torque. (c) The speed loop sees the current loop as ideal only if it is much slower; near the current-loop crossover the current lags and the loops interact, eroding margin. Speed measurement noise and quantisation (chapter 12) also grow with speed-loop bandwidth.</p>
</details>

<div class="tool-slot" data-tool="foc"></div>

# 10 | Modulation: sine PWM and space-vector PWM

The controller asks for a voltage vector; the modulator turns it into three duty cycles. How it does so decides how much of the DC link the motor can use.

<figure><img src="figures/svpwm-hex.svg" alt="Hexagon of six active voltage vectors with the two zero vectors at the centre; the inscribed circle marking the SVPWM linear limit and a smaller circle marking the sine-PWM limit."><figcaption>Figure 6. The inverter's eight switch states give six active vectors and two zero vectors. The largest circle that fits inside the hexagon is the linear range of space-vector PWM.</figcaption></figure>

## Sine-triangle PWM

Comparing each phase's sinusoidal reference with a triangle carrier gives duty \(d_k=\tfrac12+\tfrac12m\cos(\theta-k\cdot120°)\). With modulation index \(m\) = phase peak / \((V_{dc}/2)\), the linear range ends at \(m=1\): a phase peak of 12 V from 24 V, or 20.8 V line to line.

## Space-vector PWM and zero-sequence injection

The motor neutral floats, so adding the same voltage to all three phases changes nothing the motor sees. Space-vector PWM uses that freedom to centre the three duties, adding \(-\tfrac12(\max+\min)\) of the three references to each (min–max injection). The phase duties then use the full DC link, and the linear range extends to a phase peak of \(V_{dc}/\sqrt3\): 13.9 V at 24 V, 15.5% more than sine PWM. This is the same result as the classical sector-and-dwell-time formulation of SVPWM with symmetric zero vectors; the injection form is simpler to code.

## Overmodulation and six-step

Beyond \(m=2/\sqrt3\approx1.155\) even SVPWM saturates: the duty clips, the output contains low-order harmonics and the current loops see a gain drop. Full six-step operation (square-wave phases) gives a fundamental phase peak of \(2V_{dc}/\pi=15.3\) V, the most voltage the inverter can make, with large harmonics. Drives that need the last few percent of speed use overmodulation strategies; others stop at the linear limit with a margin (Laboratory 6 uses 95%).

## Dead-time distortion

Chapter 4's dead-time error is \(V_{dc}t_df_{pwm}\), here 0.24 V per phase, with the sign of the phase current. It distorts the current near each zero crossing, and at low speed it is a large fraction of the back-EMF (0.94 V at 300 rpm). Compensation adds the expected error to the command based on the current sign; it is only as good as the current-sign detection near zero.

### Exercise 10 · How much speed does SVPWM buy?

Using chapter 8's numbers, estimate E1's no-load speed limit in the linear range with sine PWM and with SVPWM at 24 V, ignoring resistance. Then use Laboratory 5 to find where each modulator starts clipping.

<details><summary>Worked solution</summary>
<p>No load: \(v_q\approx\omega_e\psi\). Sine PWM allows 12 V, so \(\omega_e=12/0.0075=1600\) rad/s and \(n=1600/4\times60/2\pi=3820\) rpm. SVPWM allows 13.86 V: \(\omega_e=1848\) rad/s, 4410 rpm, 15.5% more. With a 95% margin, 4190 rpm. Laboratory 5 shows sine PWM clipping above m = 1.00 and SVPWM above m ≈ 1.155.</p>
</details>

<div class="tool-slot" data-tool="svpwm"></div>

# 11 | Current sensing for field-oriented control

FOC needs at least two phase currents, sampled at the right instant, with small offset and delay. The sensing scheme constrains the modulation.

## Low-side shunts

A shunt in each low-side leg (Figure 2) measures that phase's current only while its low-side switch conducts. With centre-aligned PWM, all three low sides conduct around the counter's centre point (the zero vector 000), so sampling within that settled interval can give useful phase currents. A single ADC sample is an instantaneous value; symmetry does not automatically average out ripple. Its position relative to the switching edges determines how well it represents the period average. At high modulation one phase's low-side on-time becomes too short for the amplifier and ADC to settle. Use the two phases with the longest low-side time and compute the third from \(i_a+i_b+i_c=0\). Three shunts allow choosing the best two each period; two shunts restrict modulation slightly.

## Single shunt

One shunt in the DC-link return sees the current of whichever phase connects to a rail alone during each active vector. Sampling twice per period, during two different active vectors, reconstructs two phase currents. The vectors must last long enough for the measurement, so near sector boundaries and at low modulation the PWM must be shifted to create measurement windows, which adds ripple and acoustic noise. It saves parts at the price of firmware complexity.

## In-line sensing

A shunt or Hall sensor in the motor lead sees the phase current all the time, but its common-mode voltage swings with the PWM. It needs an amplifier with high common-mode rejection at the PWM edges, or an isolated sensor.

## E1's numbers

A 10 mΩ low-side shunt carries up to 8 A, giving 80 mV; an amplifier gain of 20 makes it 1.6 V around a mid-supply offset for bidirectional current. A 12-bit, 3.3 V ADC then resolves 0.8 mV, or 4 mA. Each low-side shunt conducts about half the time, so at 5.7 A RMS it dissipates about \(\tfrac12\times5.7^2\times0.01=0.16\) W. An **input-referred** amplifier offset of 1 mV produces \(1\,\text{mV}/10\,\text{mΩ}=100\) mA of current error; only a 1 mV **output-referred** offset gives \(1\,\text{mV}/(20\times10\,\text{mΩ})=5\) mA. Datasheet offset is normally input-referred; [TI’s current-sense error discussion](https://www.ti.com/document-viewer/lit/html/SSZTCG8/GUID-1931FFDD-BFFE-4EA6-8F50-AAF2A9E0A66B) separates this from gain error. Calibrate at verified zero current, with a stationary rotor and the intended sampling sequence. Equal 50% duties impose zero line-to-line voltage ideally, but do not guarantee zero current in a spinning motor.

## Timing

The sample instant, conversion time, transforms, PI updates and duty write must fit in one period, and the result must reach the timer before its next update event. Write that timeline, as the [buck course](https://psym.pl/buck-course/#ch11) does for its loop, and measure it with a spare pin. The delay it measures is the delay in chapter 6's margin.

### Exercise 11 · Choose a sensing scheme

For E1 with SVPWM up to m = 1.1, choose between three low-side shunts and a single shunt. State the minimum low-side on-time your amplifier and ADC need, check it at m = 1.1 and 20 kHz, and describe how you calibrate offsets.

<details><summary>Worked solution</summary>
<p>With min–max injection the largest duty is \(0.5+\tfrac{\sqrt3}{4}m\approx0.976\) at m = 1.1, so the shortest low-side window is about 2.4% of 50 µs, 1.2 µs: too short for many amplifier and ADC combinations to settle (typically 1–3 µs). Three shunts permit choosing the two phases with the longest windows, but still require a timing check: at this modulation the worst second-longest low-side window is \((0.5-3m/8)T=4.38\) µs. A sample at its centre has only 2.19 µs from the preceding edge, before subtracting dead time and acquisition margin. A chain needing 3 µs is therefore not automatically covered. A single shunt would need measurement-window insertion near every sector boundary. Calibrate with the rotor stationary and zero current verified, using the intended sampling sequence; average many samples per channel and subtract. Equal duties alone do not establish zero current.</p>
</details>

# 12 | Position, speed and observers

FOC needs the electrical angle continuously; six-step needs only the six Hall edges. Angle accuracy turns directly into torque and efficiency.

## What an angle error costs

If the controller's angle is wrong by \(\Delta\theta\), the current it believes is pure \(i_q\) is really split: torque falls by \(\cos\Delta\theta\) and a component \(\sin\Delta\theta\) appears on the d axis, adding loss or weakening the field unintentionally. A 10° error costs 1.5% of torque and puts 17% of the current on the wrong axis. Angle errors that vary with position become torque ripple.

## Hall sensors with interpolation

Halls give an edge every 60°. Using them directly for FOC means an angle error up to ±30° (average torque 95.5%, large ripple). Interpolating between edges with the speed measured over the last interval works well at steady speed and poorly during fast acceleration or at very low speed. Hall placement errors add a fixed error per sector; calibrate by measuring each edge's angle relative to the back-EMF.

## Encoders and magnetic angle sensors

An incremental encoder with 1024 lines gives 4096 counts per revolution after quadrature decoding. On E1's four pole pairs that is 0.35° electrical per count, plenty for FOC. It needs an index or an alignment step at startup to know the absolute electrical angle. Speed from counts per sampling period (the M method) at a 1 kHz speed loop resolves \(1/(4096\times1\,\text{ms})\) rev/s, or 14.6 rpm per count: coarse at low speed. Measuring the time between counts (the T method) or filtering with a tracking observer fixes that at the cost of delay. Absolute magnetic angle sensors on the shaft end give 12–14 bits per revolution directly; check their latency, which adds to the control delay.

## Sensorless observers

Above a few percent of rated speed the back-EMF reveals the angle. A back-EMF observer estimates \(e_\alpha\), \(e_\beta\) from the measured voltage and current through the motor model; a phase-locked loop extracts angle and speed from them. Sliding-mode observers are similar with a switching correction term. All depend on accurate \(R\) and \(L\) (resistance changes with temperature) and on knowing the applied voltage, so dead-time error hurts them at low speed. Below the observer's minimum speed, drives start open-loop (an I/f ramp: rotate a current vector at increasing frequency) and hand over, as in chapter 7. Interior-magnet motors allow high-frequency injection, which detects saliency even at standstill. TI's [SPRABQ3](https://www.ti.com/lit/an/sprabq3/sprabq3.pdf) and Microchip's [AN1078](https://ww1.microchip.com/downloads/en/AppNotes/01078B.pdf) describe complete sensorless FOC implementations.

### Exercise 12 · Pick a position source

For three E1 applications, choose Halls, an encoder, a magnetic sensor or sensorless, and justify: (a) a fan that runs 1000–4000 rpm; (b) a robot joint holding position at standstill; (c) a pump that must start reliably against a stiff load.

<details><summary>Worked solution</summary>
<p>(a) Sensorless back-EMF observer: the speed range starts well above the minimum, and starting a fan is easy. (b) Encoder or absolute magnetic sensor: standstill torque control needs the angle at zero speed; sensorless cannot provide it on an SPM. (c) Halls (or Halls plus an observer above a crossover speed): they give a known angle at standstill for a reliable start under load, and are cheap.</p>
</details>

# 13 | The mechanical system and the speed loop

The motor drives a load with inertia, friction and disturbances. Speed control is mostly a mechanical problem seen through a current loop.

## The mechanical model

\[
J\frac{d\omega_m}{dt}=T_e-B\omega_m-T_L.
\]

With the current loop fast enough to be ideal, \(T_e=K_ti_q\) and the plant from \(i_q\) to speed is \(K_t/(Js+B)\), an integrator above \(B/J\) (0.03 Hz for E1). Maximum acceleration is \(K_tI_{max}/J\): for E1, 0.36 N·m over 50 × 10⁻⁶ kg·m² gives 7200 rad/s², so 3000 rpm takes about 44 ms at full current. A load with ten times the inertia takes ten times longer and stores ten times the braking energy (chapter 15).

## Disturbance rejection

A load step \(\Delta T\) makes the speed fall until the integral action restores it. To first order the dip scales with \(\Delta T/(J\omega_c)\), where \(\omega_c\) is the speed-loop crossover: for E1 and 0.15 N·m at 50 Hz the estimate is about 90 rpm, and Laboratory 4 shows 68 rpm; at 150 Hz, 24 rpm. Faster speed loops need less inertia, better speed measurement and a faster current loop.

## Practical limits on speed bandwidth

- Keep the speed loop at least 5–10× slower than the current loop.
- Speed measured from an encoder is quantised and must be filtered; each filter adds phase lag.
- Mechanical resonances between motor and load (a flexible coupling, a belt) limit bandwidth far below the motor's own; test with the real load.
- Limit the speed reference's rate of change to what the current limit can follow, or the integrator winds up during long accelerations.

## Inertia mismatch

The speed-loop gain depends on \(J\). Tuned for E1's rotor alone, the loop is ten times slower with a load ten times heavier; tuned for the load, it can be unstable when the load is decoupled. Measure the total inertia on the real system (chapter 17) and design for its range.

### Exercise 13 · Tune for a heavier load

E1 drives a flywheel that raises the total inertia to 500 × 10⁻⁶ kg·m². Compute the acceleration time to 3000 rpm at full current, the speed-loop gains for a 50 Hz crossover, and the expected dip for a 0.15 N·m step. Verify with Laboratory 4.

<details><summary>Worked solution</summary>
<p>Acceleration: 720 rad/s², about 0.44 s to 3000 rpm. Gains scale with J: \(K_p=2\pi\times50\times500\times10^{-6}/0.045=3.5\) A·s/rad, \(K_i=274\) A/rad. The dip scales with \(1/J\) at the same crossover: about one-tenth of 68 rpm, roughly 7 rpm. In the tool, set J = 500 and simulate long enough (for example 1 s, with the load at 0.6 s) to see it.</p>
</details>

# 14 | Field weakening and the operating envelope

A motor's speed is limited by the voltage its inverter can apply; its torque by the current. Field weakening trades one against the other.

<figure><img src="figures/circles.svg" alt="In the id–iq plane: a current-limit circle centred at the origin; voltage-limit circles centred at minus psi over L whose radius shrinks with speed; at higher speed the best operating point lies at negative id where the voltage circle cuts the current circle."><figcaption>Figure 7. Current and voltage limits in the dq plane. Above base speed the voltage circle no longer contains the top of the current circle, and the best point moves to negative \(i_d\).</figcaption></figure>

## Two circles

Ignoring resistance, the steady-state voltage of a surface-magnet motor is \(v_d=-\omega_eLi_q\), \(v_q=\omega_e(Li_d+\psi)\). The voltage limit \(|v|\le V_{max}\) becomes

\[
\left(i_d+\frac{\psi}{L}\right)^2+i_q^2\le\left(\frac{V_{max}}{\omega_eL}\right)^2,
\]

a circle centred at \(-\psi/L\) whose radius shrinks as speed rises. The current limit \(i_d^2+i_q^2\le I_{max}^2\) is a fixed circle at the origin. The motor can operate only where both hold.

## Base speed and field weakening

Below **base speed** the voltage circle contains the point \((0,I_{max})\): full torque with \(i_d=0\). Above it, \(i_q\) must fall unless \(i_d\) goes negative. A negative \(i_d\) moves the operating point toward the voltage circle's centre, opposing the magnet flux in the voltage equation: field weakening. It costs current (and copper loss) that makes no torque in a surface-magnet motor.

For E1 with 95% of the SVPWM limit and resistance included, Laboratory 6 finds base speed near 3360 rpm. Without field weakening the torque falls to zero near 4210 rpm. With field weakening the envelope extends to about 7200 rpm, and the peak mechanical power rises from about 125 W (at base speed) to about 134 W near 3800 rpm.

## The characteristic current

The voltage circle's centre \(\psi/L\) is the current that would cancel the magnet's flux completely: E1's is 18.75 A. When it exceeds \(I_{max}\) (as here, 8 A), field weakening extends the speed range to a finite maximum; when it is within \(I_{max}\), constant-power operation can in theory continue to very high speed. Large negative \(d\) currents can also partially **demagnetise** the magnets, especially when hot; the motor datasheet's limit takes precedence.

## Uncontrolled generation

A motor spinning above the speed at which its line-to-line back-EMF peak exceeds the DC link (\(\sqrt3\psi\omega_e>V_{dc}\), 4410 rpm for E1) turns the inverter's body diodes into a rectifier as soon as the switches stop. If the drive trips while field-weakening at 7000 rpm, E1's back-EMF reaches about 38 V line to line and pumps current into a 24 V bus that cannot accept it. Field weakening therefore requires an answer for the moment control is lost: a brake chopper, an active short circuit that the motor and inverter can survive at that speed (chapter 15), or a speed limit below the generation threshold.

## Interior magnets and MTPA

In an interior-magnet motor (\(L_q>L_d\)) negative \(i_d\) also produces reluctance torque, so even below base speed the best current angle is not 90°: **maximum torque per ampere** (MTPA) control uses a negative \(i_d\) that depends on load. Field weakening then follows the voltage limit from the MTPA curve. E1 is a surface-magnet motor, so MTPA is simply \(i_d=0\).

### Exercise 14 · Map E1's envelope

With Laboratory 6, find the base speed, the zero-torque speed without field weakening, the maximum speed with it and the \(i_d\) used at 5000 rpm. Then decide the highest speed you would allow in service, given the uncontrolled-generation threshold and a supply that cannot sink current.

<details><summary>Worked solution</summary>
<p>Base speed ≈ 3360 rpm; zero torque without field weakening ≈ 4210 rpm; maximum with field weakening ≈ 7200 rpm; at 5000 rpm the tool uses about −6.2 A of \(i_d\), leaving about 5.1 A of \(i_q\) (0.23 N·m). The uncontrolled-generation threshold is about 4410 rpm. Without a brake chopper or a sinking supply, a fault above that speed charges the bus, so limit service speed to about 4200 rpm (still slightly into field weakening near the top), or add a brake chopper sized for the generated power (chapter 15) before using the extended range.</p>
</details>

<div class="tool-slot" data-tool="envelope"></div>

# 15 | Braking, regeneration and protection

A motor drive must stop safely, survive faults and keep its DC link within limits. Returned energy and short-circuit current must both be included in the fault analysis.

## Where braking energy goes

Decelerating the rotor turns kinetic energy \(\tfrac12J\omega^2\) back into electrical energy. Part of it is lost in copper and switches; the rest flows into the DC link. A laboratory supply, a diode-fed rectifier and many adapters cannot accept current, so the DC-link capacitor absorbs it and its voltage rises:

\[
V_{end}=\sqrt{V_{dc}^2+\frac{2E_{bus}}{C}}.
\]

E1 stopping from 3000 rpm in 50 ms releases 2.47 J; with a nominal 5 W loss capped at the instantaneous released power, 2.22 J reaches the 470 µF bus, which would rise to about 100 V, far above the MOSFETs' rating. Between 24 and 30 V the capacitor can take only 0.076 J. A larger flywheel makes it worse in proportion.

## Three ways out

1. **Limit deceleration** so the returned power stays below the losses: practical for fans and pumps, useless for an emergency stop.
2. **Brake chopper:** a switch and resistor across the DC link that turns on above a threshold. For E1's stop, the peak returned power is about 94 W, so the resistor must be at most \(30^2/94\approx9.6\) Ω at a 30 V threshold, rated for the energy per stop and the duty of repeated stops.
3. **A source that sinks:** a battery can absorb energy, but check that its management system will not disconnect on charge current or overvoltage, leaving the drive with nowhere to put it.

## Safe states after a fault

| State | What happens | When it is safe |
|---|---|---|
| All switches off (coast) | Motor freewheels; body diodes rectify if the back-EMF exceeds the bus | Below the uncontrolled-generation speed (4410 rpm for E1), after accounting for stored winding energy and permissible coasting distance |
| Active short circuit (all low sides on) | Phases shorted; current approaches \(\psi\omega_e/\sqrt{R^2+(\omega_eL)^2}\), braking torque | Only if that current is within ratings: E1's tends to \(\psi/L=18.75\) A at high speed, over twice its limit; at 300 rpm it is about 3.7 A, at 1000 rpm 10.4 A. These are steady values; the transient can be larger (chapter 21) |
| Controlled stop | Regenerative braking with a chopper or a sinking source | When the controller and its sensing are healthy |

There is no universally safe state: write down which state each fault leads to and why.

## Protection paths

- **Overcurrent:** a comparator on the shunt signals into the timer's hardware break input and commands the selected hardware fault state independently of firmware. Measure the complete sensing, comparator, timer, driver and MOSFET delay; a sub-microsecond target is not a guaranteed property of an arbitrary implementation. Its threshold sits above the regulated limit with margin.
- **Bus overvoltage:** a comparator on the DC link enables the brake chopper; a second, higher threshold stops switching.
- **Undervoltage:** the gate driver's UVLO and the controller's own check prevent partial gate drive.
- **Position faults:** Hall codes 000 and 111, an encoder that stops counting, or an observer whose estimate disagrees with expectations require a fault response that remains usable after that sensor fails. A controlled stop needs a valid angle/current path or a validated fallback; otherwise choose an independently supported coast or brake state.
- **Stall:** large current with no speed for longer than a bounded stall timer allows; derive the timer from allowable winding and semiconductor heating rather than waiting one whole thermal time constant.
- **Overtemperature:** of the inverter and, through a sensor or a thermal model, of the windings.

### Exercise 15 · Plan E1's stop

E1 must stop from 3000 rpm in 50 ms on command, and in under 100 ms on an emergency stop, from a laboratory supply that cannot sink current. Use Laboratory 7 to size a brake chopper, then decide the safe state for an overcurrent fault at 1000 rpm and at 4000 rpm.

<details><summary>Worked solution</summary>
<p>Brake chopper: about 94 W peak, at most 9.6 Ω at a 30 V threshold; with 8 Ω the chopper conducts at a little below full duty at the start of the stop. Energy per stop is about 2.2 J, so a 5–10 W resistor with a good pulse rating handles occasional stops; repeated stops need an average-power check. Overcurrent at 1000 rpm: all switches off avoids sustained diode rectification because back-EMF is well below the bus; the capacitor/chopper must still absorb the initial winding energy. Active short circuit is **not** within the 8 A limit: the steady current is 10.4 A even before the transient is considered. At 4000 rpm all off is still below the 4410 rpm generation threshold, but close, so account for winding energy, speed/flux/bus tolerances and chopper response; an active short circuit would approach twice the current rating and is not acceptable for E1.</p>
</details>

<div class="tool-slot" data-tool="regen"></div>

# 16 | Hardware, layout and thermal design

A motor drive is three power converters sharing a DC link, plus sensitive measurements in the middle of them.

## Power-stage layout

Each half-bridge has its own commutation loop: its two switches and the ceramic capacitor across them. Place a ceramic directly at each leg, keep the loop small and return each leg through its shunt to a common point near the bulk capacitor. The [buck course's](https://psym.pl/buck-course/#ch14) layout chapter applies leg by leg. Keep gate loops short, with the driver close to its switches and the high-side driver's return to the switch node, not to ground.

## Shunt and amplifier routing

Shunt signals are tens of millivolts beside amperes switching in nanoseconds. Route Kelvin pairs from each shunt's pads to its amplifier, keep amplifiers near the shunts, filter only enough to remove edge spikes (the filter delay adds to the control delay) and give the analog ground one deliberate connection to the power ground near the shunts' common point.

## The motor cable and the motor

The inverter outputs switch at kilovolts per microsecond. Capacitance from windings to the motor frame (hundreds of picofarads) turns each edge into common-mode current: 24 V in 20 ns through 100 pF is about 120 mA. That current returns through the frame, the mounting and any earth, causing EMI and, in larger machines, bearing currents. Short cables, slower edges where efficiency allows, and a defined return path for the frame current help.

## Thermal design

Conduction loss per MOSFET is about \(\tfrac12I_{ph,rms}^2R_{DS(on)}\) in FOC, plus switching loss proportional to frequency. For a small 24 V drive these are often below 0.2 W per device; the shunts, the bulk capacitor's ripple heating and the motor itself are larger. In six-step, the switches that carry the current for 120° and chop it carry more loss than the others. Measure the hottest component at the worst operating point (stall at current limit is often worst).

### Exercise 16 · Review a layout

List the ten things you would check on a three-phase inverter layout for E1 before ordering boards, in order of the damage an error would cause.

<details><summary>Review criteria</summary>
<p>Good lists start with the commutation loop per leg and its ceramic, shunt Kelvin routing and amplifier placement, gate loops and driver placement, DC-link capacitor connection and ripple rating, bootstrap components, the overcurrent comparator path to the timer break input, creepage/clearance of the motor connector (low voltage here, but connector ratings), copper width and thermal relief for phase currents, separation of Hall/encoder inputs from phase outputs, and the analog/power ground connection.</p>
</details>

# 17 | Bench bring-up and parameter identification

A drive is only as good as the motor model it uses. Measure the motor before tuning anything, and bring the hardware up in bounded steps.

## Identify the motor

| Parameter | Method | E1 expectation |
|---|---|---|
| Resistance | Four-wire DC measurement line to line, divide by two for star | 0.5 Ω line to line, 0.25 Ω phase, at a recorded temperature |
| Inductance | LCR meter at 1 kHz line to line, or a voltage step and its time constant | 0.8 mH line to line; \(\tau=1.6\) ms |
| Flux linkage | Spin at a known speed (a drill or a second motor), measure line-to-line RMS voltage: \(\psi=\sqrt2V_{LL,rms}/(\sqrt3\omega_e)\) | 11.5 V RMS at 3000 rpm gives 7.5 mWb |
| Pole pairs | Electrical frequency divided by mechanical rotation frequency | 200 Hz at 50 rev/s: 4 |
| Hall alignment | Inject DC current along phase A (A+, B− and C− together), let the rotor settle, read the Hall code and its edges | Code and offset per sector |
| Inertia | Accelerate with known \(i_q\) and measure \(\alpha\): \(J=(K_ti_q-T_f)/\alpha\); friction from a coast-down | 50 × 10⁻⁶ kg·m² |

For an interior-magnet motor, measure inductance at several rotor positions to find \(L_d\) and \(L_q\).

## Staged bring-up

| Stage | Setup | Evidence before advancing |
|---|---|---|
| B0 | Unpowered inspection and continuity | Shorts, polarity, shunt values |
| B1 | Logic and gate drive only, DC link at a few volts through a current limit | PWM, dead time and break input on a scope; Hall/encoder readings by hand |
| B2 | Motor disconnected, low DC link | Phase voltages with each duty; offset calibration of current sensing |
| B3 | Motor connected, secured, low DC link, low current limit | Open-loop alignment and slow rotation; measured currents match commands |
| B4 | Closed current loop | Step responses against Laboratory 3; no oscillation at any angle |
| B5 | Speed loop, full voltage, increasing speed | Speed steps and load steps; bus voltage during deceleration |
| B6 | Faults | Overcurrent trip delay, Hall fault, stall, bus overvoltage, each at reduced energy first |

Secure the motor and guard rotating parts. Know where braking energy goes before the first deceleration at full voltage. A bench supply's current limit does not protect against energy returned by the motor.

### Exercise 17 · Identify an unknown motor

You receive a motor with no datasheet. Write the measurement sequence and the calculations that give \(R\), \(L\), \(\psi\), \(p\), Hall alignment and \(J\), with the instruments for each. State which measurement must come first and why.

<details><summary>Review criteria</summary>
<p>Resistance first: it needs no rotation and sets safe current levels for later tests. Then pole pairs and flux linkage by spinning externally (no drive involved), inductance with an LCR meter or a current-limited step, then Hall alignment with a small DC current from a current-limited supply, and inertia last, once a working current loop allows controlled acceleration. Each step records temperature, instrument and conditions.</p>
</details>

# 18 | Design review and capstone

You are ready to build when you can defend E1's drive at every operating point and in every fault. Use these gates; the notebook tracks them.

| Gate | Deliverable | What a reviewer verifies |
|---|---|---|
| G0 requirements and motor data | Speed/torque profile, supply, identified motor parameters | Units and definitions of every constant |
| G1 inverter and sensing | Power stage, gate drive, current sensing scheme | Ratings with margin; sampling windows at maximum modulation |
| G2 commutation | Six-step table or FOC angle source with alignment | Angle error budget; startup method |
| G3 current and speed control | Loop designs and timeline | Margins including delay; anti-windup; tested steps |
| G4 operating envelope | Base speed, field-weakening range, service speed limit | Voltage and current limits; uncontrolled-generation threshold |
| G5 braking and protection | Energy plan and fault table | Every fault reaches a defined, survivable state |
| G6 CAD and layout | Schematic, layout, checks | Commutation loops, Kelvin shunts, break path |
| G7 bench evidence | Test records B0–B6 | Measured parameters, responses and fault behaviour |

## Oral examination

1. Give E1's torque per ampere in three definitions, and say when each applies.
2. Why does six-step drive of a sinusoidal motor produce 13–14% torque ripple?
3. What limits E1's current-loop crossover, and what margin does 1 kHz leave at 20 kHz PWM?
4. What happens to the rotor-frame currents when the angle estimate is 10° off?
5. Why does SVPWM give 15.5% more voltage than sine PWM?
6. Where is E1's base speed, and what does field weakening cost?
7. What happens to the bus when E1 stops from 3000 rpm in 50 ms on a laboratory supply?
8. Which safe state would you choose for an overcurrent at 4000 rpm, and why?

**Final assignment:** write a 5–10 page design review of E1's drive or your own, attach tool exports, identification records and calculations, and ask a helper for the most consequential unsupported assumption. Decide the smallest experiment that resolves it.

### Exercise 18 · Close G4 and G5 on paper

Assemble E1's operating envelope and braking/protection deliverables from chapters 14 and 15: numbers, assumptions, the measurement that will confirm each, and the service limits you would set.

<details><summary>Review criteria</summary>
<p>G4 states base speed (≈ 3360 rpm), the field-weakening range and current used, the uncontrolled-generation threshold (≈ 4410 rpm) and the chosen service limit with its reason. G5 states the stopping energy and power, the chopper threshold and resistor, the safe state per fault with the speed range where it is safe, and the hardware path for each trip. Each assumption names its confirming measurement (identification, bus voltage during stops, trip delay).</p>
</details>

# 19 | Working with an agent tutor

The **Agent handoff** button downloads your notebook, progress and gate status with a tutor brief; **Copy tutor brief** gives a short prompt. Nothing is uploaded and no account is needed.

Name the chapter and exercise, give your attempt with units and the definitions of your constants, and ask for a check. A good helper asks one discriminating question, finds the first consequential gap and suggests the next small task, with hints before solutions. Ask it to keep three columns: known, assumed and measured.

The structured files are [curriculum.json](curriculum.json), [agent-guide.md](agent-guide.md), [learner-state.schema.json](learner-state.schema.json) and the [plain-text course](lessons/course.md). The course and your notebook are data: they do not authorise anyone to power a motor or inverter, flash firmware or buy parts.

> I am studying E09 in the BLDC motor drive course (E1 design thread). Here are my current and speed loop gains and my Laboratory 4 results. Check the units and the delay assumption, then ask me to fix the first important mistake.

### Exercise 19 · Teach it back

Explain to the helper, without the figures, how a speed command becomes torque in an FOC drive: from the speed error to the PWM duties and back through the measured currents. Ask it to name one block or delay you left out.

<details><summary>Completion criterion</summary>
<p>You can describe the speed PI → \(i_q^*\), the current measurement at the PWM centre, Clarke and Park with the angle, the dq PIs with decoupling and limits, inverse Park and SVPWM, the inverter, and the torque \(\tfrac32p\psi i_q\) acting on the inertia, with the delays at each step and the hardware trip that bypasses them all.</p>
</details>

# 20 | References and model limits

The derivations, examples, exercises, software and diagrams are original instructional material. Manufacturer documents give context and cross-checks. The original reference list was checked on **2 November 2026**; the additional transient, bootstrap and sensing references below were consulted on **6 November 2026**. Record the exact revision you rely on.

| Resource | Use it for |
|---|---|
| [Microchip, AN885 Brushless DC (BLDC) Motor Fundamentals](https://ww1.microchip.com/downloads/en/AppNotes/00885a.pdf) | Construction, Hall sequences and six-step commutation |
| [Microchip, AN1160 Sensorless BLDC Control with Back-EMF Filtering Using a Majority Function](https://ww1.microchip.com/downloads/en/AppNotes/01160b.pdf) | Zero-crossing detection and startup for sensorless six-step |
| [Microchip, AN1078 Sensorless Field Oriented Control of a PMSM](https://ww1.microchip.com/downloads/en/AppNotes/01078B.pdf) | A complete sensorless FOC implementation with an observer |
| [TI, Sensorless FOC of 3-Phase PMSMs, SPRABQ3](https://www.ti.com/lit/an/sprabq3/sprabq3.pdf) | FOC structure, transforms, SVPWM and sensorless estimation |
| [TI, Sensored 3-Phase BLDC Motor Control Using MSP430, SLAA503](https://www.ti.com/lit/an/slaa503/slaa503.pdf) | A small-MCU Hall-sensor six-step drive |
| J. W. Kolar and S. D. Round, “Analytical calculation of the RMS current stress on the DC-link capacitor of voltage-PWM converter systems”, *IEE Proc. Electric Power Applications* 153(4), 2006 | The DC-link capacitor current formula in chapter 4 |
| [G. F. Olson et al., Guaranteed Torque and Demagnetization Current During Active Short-Circuit Transients of PMSMs (2024)](https://iris.polito.it/handle/11583/2989362) | Why pre-fault currents and transient torque/demagnetisation constraints matter; chapter 21 uses its own simpler linear model |
| [TI, How to Get Started with Current Sense Amplifiers — Part 4](https://www.ti.com/document-viewer/lit/html/SSZTCG8/GUID-1931FFDD-BFFE-4EA6-8F50-AAF2A9E0A66B) | Input offset versus gain error in chapter 11 |
| [Infineon, Bootstrap capacitor calculation for SVPWM in CIPOS Maxi](https://community.infineon.com/t5/Knowledge-Base-Articles/How-to-calculate-the-bootstrap-capacitor-for-SVPWM-modulation-scheme-in-CIPOS/ta-p/1107844) | Dependence of bootstrap discharge/recharge on the modulation scheme |
| R. Krishnan, *Permanent Magnet Synchronous and Brushless DC Motor Drives*, CRC Press, 2010 | Machine models, field weakening and MTPA |
| D. W. Novotny and T. A. Lipo, *Vector Control and Dynamics of AC Drives*, Oxford, 1996 | Reference frames and vector control theory |

Related courses: [buck converters](https://psym.pl/buck-course/), [mains AC switching](https://psym.pl/mains-course/), [power LED drivers](https://psym.pl/led-course/).

## Notation and conventions

| Symbol | Meaning |
|---|---|
| \(p\) | Pole pairs; \(\theta_e=p\theta_m\), \(\omega_e=p\omega_m\) |
| \(\psi\) | Magnet flux linkage, phase peak (amplitude-invariant transforms) |
| \(R\), \(L\) | Phase (star-equivalent) resistance and inductance; line-to-line values are twice these |
| \(K_6\) | Six-step DC-equivalent constant \(\approx1.654\psi p\), V·s/rad = N·m per conducting-pair ampere (DC-link current only at full duty) |
| \(K_t\) | FOC torque constant \(\tfrac32p\psi\), N·m per phase-peak ampere |
| \(m\) | Modulation index: phase peak / \((V_{dc}/2)\) |

## Model limitations in one place

The DC-motor tool omits iron and inverter loss. The six-step tool uses ideal 120° current blocks and instantaneous commutation. The current-loop tool simulates an ideal R–L plant with a sampled PI, a 1.5-period delay and a voltage limit, without PWM ripple or sensing filters. The FOC tool simulates an ideal sinusoidal surface-magnet machine with ideal inverter, sensors and angle, and runs both loops at one rate. The modulation tool computes averaged duties. The envelope tool uses steady-state equations with resistance, without iron loss, saturation or magnet temperature. The braking tool assumes constant deceleration, caps requested dissipation at the instantaneous mechanical power and integrates only positive returned power; it does not model a motoring tail, chopper dynamics or the initial winding energy. The active-short tool (chapter 21) solves a linear SPM at fixed speed: it resolves electrical current transients but omits mechanical deceleration, saturation, magnet damage and switching transitions. None identifies a motor, selects components or qualifies a drive.


# 21 | Extension: fault currents and a complete stopping-energy ledger

Chapters 14–15 compare operating limits and steady fault states. This extension asks what happens **during the transition**. A current below its limit in the final state does not establish that the path to that state is acceptable. The active-short research by [Olson and colleagues](https://iris.polito.it/handle/11583/2989362) explicitly treats transient torque, current and demagnetisation as constraints; the linear model below is a smaller teaching calculation derived from chapter 8, not that paper's nonlinear qualification method.

## Steady active short from the dq equations

With all three motor terminals tied together, the applied line-to-line voltage is zero. For the ideal surface PMSM set \(v_d=v_q=0\), hold speed fixed briefly, and solve chapter 8 at steady state:

\[
i_{d,ss}=-\frac{\omega_e^2L\psi}{R^2+(\omega_eL)^2},\qquad
i_{q,ss}=-\frac{\omega_e R\psi}{R^2+(\omega_eL)^2},\qquad
I_{ss}=\frac{\omega_e\psi}{\sqrt{R^2+(\omega_eL)^2}}.
\]

This current is a space-vector magnitude, equal to phase peak for a balanced sinusoidal steady state. It is not RMS. For E1:

| Mechanical speed | Steady magnitude | Interpretation against 8 A peak |
|---|---|---|
| 300 rpm | 3.70 A | Below the limit in steady state; entry transient remains to check |
| 1000 rpm | 10.44 A | Already above the limit |
| 4000 rpm | 17.57 A | Already above the limit |
| Very high speed | 18.75 A | Limit \(\psi/L\), mostly negative d current |

Solving \(I_{ss}=8\) A gives about 704 rpm. This is a **steady-state crossing**, not a permissible switching speed. Magnet demagnetisation limits concern negative \(i_d\), and may be more restrictive than the inverter's current limit.

## The entry transient

Let \(\delta i_d=i_d-i_{d,ss}\), \(\delta i_q=i_q-i_{q,ss}\), and \(\tau=L/R\). With fixed speed, the exact solution is

\[
\begin{bmatrix}\delta i_d(t)\\\delta i_q(t)\end{bmatrix}
=e^{-t/\tau}
\begin{bmatrix}\cos\omega_et&\sin\omega_et\\-\sin\omega_et&\cos\omega_et\end{bmatrix}
\begin{bmatrix}\delta i_d(0)\\\delta i_q(0)\end{bmatrix}.
\]

E1 has \(\tau=1.6\) ms. Shorting from zero initial current at 4000 rpm gives about **23.53 A** peak magnitude at **1.58 ms**, although the eventual magnitude is 17.57 A. The initial \(i_d,i_q\) matter: a loaded motoring point and a field-weakening point do not enter the short from the same state. Laboratory 8 exposes both initial currents. Its speed is fixed over the displayed interval; this approximation becomes weaker as braking torque changes the speed appreciably. It is not a rotor-stopping simulation.

<div class="tool-slot" data-tool="shortcircuit"></div>

## Reconcile the braking power and the energy

For a constant-deceleration segment, define positive \(\alpha=(\omega_1-\omega_2)/t_s\), so \(\omega(t)=\omega_1-\alpha t\) and the released kinetic power is \(P_m=J\alpha\omega(t)\). Laboratory 7 treats the entered loss \(P_\ell\) as an available dissipation capped at \(P_m\):

\[
P_{bus}(t)=\max[J\alpha(\omega_1-\alpha t)-P_\ell,0],\qquad
E_{bus}(t)=\int_0^tP_{bus}(u)\,du.
\]

The voltage plot and headline voltage use this same integral. A real controller maintaining the requested trajectory could draw bus power near the end instead; the tool omits that motoring tail. Subtracting \(P_\ell t_s\) unconditionally while plotting only positive returned power mixes two different models.

For the 3000 rpm, 50 ms stop, the power starts at 93.70 W and reaches zero at about 47.47 ms. The positive-power triangle has area **2.224 J**. That predicts **100.19 V** without a chopper in 470 µF initially at 24 V. At a 30 V clamp, the capacitor stores only 0.0761 J more than at 24 V, so approximately **2.148 J** must be dissipated by the brake during this ideal stop. An 8 Ω resistor at 30 V can dissipate 112.5 W when on; the initial duty needed for 93.70 W is 83.3%. One stop every two seconds adds about 1.07 W average resistor heating, while the pulse still needs its own rating check.

Now include the winding energy at fault entry. With the amplitude-invariant convention, the linear magnetic energy is

\[
E_L=\tfrac34L(i_d^2+i_q^2).
\]

At 8 A and 0.4 mH this is **19.2 mJ**. If all of it reaches the capacitor after turn-off, its voltage rises from 24 V to about **25.65 V**, even below the uncontrolled-generation threshold. That is an upper bound on the magnetic-energy contribution alone, not the complete bus waveform: losses, rotor motion, switching and continuing generation change the actual trajectory. Check both the initial energy transfer and subsequent mechanical energy.

### Exercise 21 · Repair the fault-state argument

For E1, (a) derive the 704 rpm steady crossing and compare 1000 rpm with the 8 A limit; (b) use Laboratory 8 to compare 4000 rpm entry from \((i_d,i_q)=(0,0)\) and \((0,8)\); (c) reconcile the Laboratory 7 power area and final voltage for the default stop; (d) write a fault ledger naming initial current, speed, bus voltage, energy destination and the evidence needed before choosing coast, active short or controlled braking.

<details><summary>Worked solution and review criteria</summary>
<p>(a) \(\omega_e=I_{lim}R/\sqrt{\psi^2-(I_{lim}L)^2}\), then divide by four pole pairs and convert to rpm: about 704 rpm. At 1000 rpm the steady 10.44 A already rejects active short under the stated 8 A limit. (b) Zero-current entry peaks at 23.53 A; entry from \((0,8)\) A peaks near 24.04 A at 1.79 ms, with minimum d current about −21.98 A. The positive initial torque current changes the transient and must be included rather than assuming zero. (c) Integrate positive returned power: 2.224 J, about 100.19 V without a brake, with 2.148 J left for the brake after the capacitor rises to 30 V. (d) A complete ledger distinguishes initial winding energy, rotor energy, peak power and repetitive heat; specifies a functioning response even if the position source fails; and calls for bounded transient measurements and component/magnet limits. None of the tool results alone closes a hardware gate.</p>
</details>
