Lab 07: Hard Disk Drive Track Following
Overview
A voice-coil motor (VCM) swings the actuator arm of a hard disk drive so that the read/write head follows a data track; adjacent tracks are 60 nm apart (the track pitch). At low frequency the arm is a rigid inertia, but the pivot bearing, the arm and the suspension add lightly damped resonances at a few kilohertz, and the servo measures the head position only once per servo sector. We identify the actuator from a measured frequency response, design a lead and integral controller with a notch filter for the butterfly mode, check the design on the measured response, and use the sensitivity function to explain and predict the position error signal (PES) with its repeatable and non-repeatable runout.

Disk drive D1 of lab 07 and its track-following loop.
The system
| quantity | demo drive D1 | homework drive D2 | basis |
|---|---|---|---|
| spindle speed, servo sectors | 7200 rpm (120 Hz), 300 per revolution | 5400 rpm (90 Hz), 360 per revolution (given) | representative values |
| sample rate, $T_s$ | 36.0 kHz, 27.8 µs | 32.4 kHz, 30.9 µs (given) | |
| computation delay $\tau$ | 12 µs ($T_d = T_s/2 + \tau$ = 25.9 µs) | identify from the phase | |
| track pitch TP | 60 nm (about 420 000 tracks per inch) | 75 nm (given) | |
| VCM torque constant $K_t$, pivot-to-head length $l$ | 0.11 N m/A, 48 mm | 0.09 N m/A, 50 mm (given) | |
| actuator inertia $J$ | $1.9 \times 10^{-5}$ kg m² | identify (through $K_p$) | |
| pivot-bearing, butterfly and sway modes | 3.3, 6.2 and 11.5 kHz; $\zeta$ = 0.05, 0.015, 0.010 | identify from the measured response | |
| firmware controller | lead, integral and notch, crossover 0.8 kHz | lead, integral and notch, crossover 0.65 kHz (given) | |
| disturbances and sensing | runout of 1.2 tracks at 1x after the runout feedforward and 0.12 to 0.02 tracks at 2x-5x, written-in runout, disk flutter at 0.9 and 1.5 kHz, windage torque, 1.2 % TP rms PES noise, 12 mA flex-cable bias | similar, to be read from the PES log |
The VCM current $u$ produces the torque $K_t u$ on the actuator, and the head moves $l\,\theta$ at the end of the arm, measured in tracks. With the resonances written as a modal sum,
$$ \begin{aligned}G(s) &= K_p\left[\frac{1}{s^2} + \sum_i \frac{r_i}{s^2 + 2\zeta_i\omega_i s + \omega_i^2}\right],\\K_p &= \frac{K_t\,l}{J\,\mathrm{TP}} ,\end{aligned} $$which gives $K_p = 4.63 \times 10^9$ tracks/(A s²) for drive D1, an acceleration of 28 g per ampere. A mode with $r_i > 0$ is in phase with the rigid body and has its antiresonance below the resonance; a mode with $r_i < 0$ has it above. The servo reads the PES once per sector, $T_s = 60/(\text{rpm} \times \text{sectors})$, and the current computed from a sample reaches the coil $\tau$ later and is held until the next sector, so at low frequency the loop sees the delay $T_d = T_s/2 + \tau$. The logs are simulated from this model and are not measurements from a real drive; each data file is marked as simulated.
| step | course tool | lecture |
|---|---|---|
| swept-sine frequency response, coherence, delay from the phase slope (demo 1) | sinusoidal response, Bode plot | L20 |
| rigid-body -40 dB/dec line, resonance peaks, half-power damping, antiresonances (demo 1) | Bode plot reading, resonance | L21 |
| least-squares fit of the modal model (demo 1) | model approximation from data | L21, L22 |
| lead for the crossover and phase margin with the delay, integral term for the bias force (demo 2) | lead and lag design, steady-state error | L12, L18, L21 |
| loop without a notch: extra crossovers at the butterfly mode and an encirclement of $-1$ (demo 2) | Bode plot, Nyquist criterion | L21, L24 |
| notch filter, margins on the measured response, delay margin, $M_s$, check with python-control (demo 2) | gain, phase and delay margins, sensitivity | L24, L26 |
| RRO and NRRO, runout through $S$, waterbed effect (demo 3) | sensitivity function | L26 |
| PES predicted for a new controller, peak filter at the spindle frequency (demo 3) | sensitivity, loop shaping | L26 |
Demo 1: identifying the actuator from a measured frequency response
The drive’s servo analyzer adds a sine to the current command while the firmware controller keeps the head on the track, steps through 400 frequencies from 100 Hz to 17 kHz, and estimates the plant with the excitation as reference, as in Lab 06. It exports the magnitude in dB re 1 track/A, the phase wrapped to ±180° and the coherence. The coherence is close to 1 almost everywhere; it dips at the disk-flutter frequencies, at the antiresonance near 5 kHz and above 12 kHz, where the response is small compared with the disturbances.

Measured frequency response from VCM current to head position, with the coherence (simulated analyzer export).
Below the resonances the plant is $K_p/s^2$, whose phase is $-180^\circ$. The zero-order hold acts like a delay of $T_s/2$ and the computation adds $\tau$, so the measured phase falls on a straight line in linear frequency, $\angle G \approx -180^\circ - 360^\circ f\,T_d$. The line through $-180^\circ$ fitted on 150-1500 Hz gives $T_d$ = 25.97 µs (true 25.89 µs), so $\tau$ = 12.1 µs; the delay alone costs 9° at 1 kHz and 56° at 6 kHz. Below the modes $|G|\,\omega^2 = K_p$; the modes pull it down as the frequency rises (by 0.8 % at 600 Hz and about 6 % at 1.5 kHz), so its median is taken on 150-600 Hz. This gives $K_p$ = $4.629 \times 10^9$ tracks/(A s²), 0.1 % below the true value, and $J = K_t l/(K_p\,\mathrm{TP}) = 1.9 \times 10^{-5}$ kg m².
Dividing the measurement by the rigid-body line leaves the modes. Each peak gives a frequency and, from its half-power width, a damping ratio $\zeta_i \approx \Delta f/(2f_i)$; each antiresonance gives the modal gain through $\omega_{z,i} = \omega_i/\sqrt{1 + r_i}$. The butterfly mode stands 25 dB above the rigid-body line at 6.2 kHz.

The measured response divided by the rigid-body line: the three modes and their antiresonances.
These readings are starting values for a least-squares fit of the sampled modal model (exact zero-order hold and delay) to the points with coherence of at least 0.8. The fit matches the data within 0.31 dB and 2.0° rms and recovers every parameter of the demo drive.
| mode | $f_i$ fitted (true) | $\zeta_i$ fitted (true) | $r_i$ fitted (true) |
|---|---|---|---|
| pivot-bearing mode | 3299 Hz (3300) | 0.0503 (0.0500) | +0.080 (+0.080) |
| butterfly mode | 6200 Hz (6200) | 0.0154 (0.0150) | +0.601 (+0.600) |
| suspension sway mode | 11499 Hz (11500) | 0.0101 (0.0100) | -0.256 (-0.250) |

The fitted modal model against the measured response.
Demo 2: lead and integral design, a notch for the butterfly mode, margins on the measured response
The controller is designed on the rigid-body model $K_p e^{-sT_d}/s^2$ for a crossover of $f_c$ = 1.2 kHz, about one fifth of the butterfly frequency, with PM = 40°. An integral term $(s + \omega_i)/s$ with $f_i = f_c/10$ removes the offset caused by the flex-cable bias. At $\omega_c$ the rigid body with the delay has the phase $-180^\circ - \omega_c T_d$, and the lead supplies the rest:
$$ \begin{aligned}\phi_{max} &= PM - 180^\circ - \angle\!\left[\frac{K_p}{(j\omega_c)^2}e^{-j\omega_c T_d}\,C_{rest}(j\omega_c)\right],\\\alpha &= \frac{1 - \sin\phi_{max}}{1 + \sin\phi_{max}},\\f_z &= f_c\sqrt{\alpha},\quad f_p = \frac{f_c}{\sqrt{\alpha}},\end{aligned} $$where $C_{rest}$ holds the integral term and, later, the notch. The firmware runs at the sector rate, so each block is discretized with the Tustin rule prewarped at its own key frequency, and the loop is evaluated at $z = e^{j\omega T_s}$.
Without a notch the lead needs 56.9°, and the design model promises PM = 40°. On the measured response, however, the loop gain rises above 0 dB again at the butterfly mode, with two more crossovers near 6 kHz, and the closed-loop poles of the sampled loop on the fitted model include one outside the unit circle ($|z|$ = 1.0054, near 6.4 kHz). The Nyquist plot shows the resonance loop encircling $-1$. A notch
$$ N(s) = \frac{s^2 + 2\zeta_z\omega_0 s + \omega_0^2}{s^2 + 2\zeta_p\omega_0 s + \omega_0^2} $$at the identified butterfly frequency, 20 dB deep with $\zeta_p$ = 0.2, lowers the loop gain at the mode; it costs 3.7° at the crossover, so the lead is designed again with the notch included ($\phi_{max}$ = 60.6°, zero 315 Hz, pole 4572 Hz, $K$ = 0.003216 A/track). On the measured response the loop then has PM = 40.1° at 1.17 kHz, a gain margin of 12.4 dB at 3.7 kHz and $M_s$ = 1.72, and the delay margin $PM/\omega_c$ is 95 µs, or 3.4 samples. The FRD margins of python-control agree: GM 12.40 dB, PM 39.95°, $M_s$ = 1.73.

Nyquist plots of the measured loop (points) and the fitted model (line), without and with the notch.
The butterfly frequency varies between drives and with temperature. With the controller unchanged, an upward shift of 5 or 10 % leaves at least 9.9 dB of gain margin, but a 5 % downward shift leaves 2.8 dB and a 10 % downward shift is unstable: below $f_0$ the notch attenuates less and adds phase lag, which turns the resonance loop toward $-1$.
In the interactive version you choose the target crossover and phase margin, change the gain away from the design value, switch the notch on or off, move or reshape it, and add computation delay. The module designs the controller on the identified rigid-body model, evaluates the loop on the measured response and on the fitted model, reports the margins and $M_s$, checks python-control’s margins on the same data, and checks closed-loop stability with the poles of the sampled loop on the fitted model. $M_s$ is only meaningful while the closed loop is stable.
Interactive: loop design judged on the measured response
The button loads Python (Pyodide with numpy, scipy, matplotlib and python-control, about 40 MB on the first visit, cached afterwards) into this page; after that, changing a parameter re-runs the computation and redraws the figures. Until then the figures and numbers below are the output of the original demo script with the default parameters.
identified: Kp = 4.629e+09 track/(A s^2), Td = 25.83 us, butterfly mode 6200 Hz (zeta 0.0154) lead + integral: phi_max = 56.9 deg, zero 357 Hz, pole 4034 Hz, K = 0.003635 A/track no notch, MEASURED crossover [1173 6048 6391] Hz, PM [ 40. 113.9 -10.7] deg | GM -1.9 dB at 6340 Hz | Ms = 5.29 (14.5 dB) at 6391 Hz closed loop on the fitted model: max |z| = 1.0054 -> UNSTABLE; unstable pole near 6366 Hz lead + integral + notch: notch 6200 Hz, 20 dB, zeta_p 0.2; phi_max = 60.6 deg, zero 315 Hz, pole 4572 Hz, K = 0.003216 A/track the notch costs 3.7 deg at fc; the lead high-frequency gain is fp/fz = 14.5 (23 dB) with notch, MEASURED crossover [1172] Hz, PM [40.1] deg | GM 12.4 dB at 3740 Hz | Ms = 1.72 (4.7 dB) at 1612 Hz with notch, fitted model crossover [1166] Hz, PM [40.3] deg | GM 12.4 dB at 3735 Hz | Ms = 1.68 (4.5 dB) at 1661 Hz closed loop on the fitted model: max |z| = 0.9835 -> stable lower gain margin (integral action): -21.4 dB at 215 Hz; the loop stays stable if the gain drops by less delay margin PM/wc = 95.0 us = 3.4 samples (the loop already has Td = 25.8 us) python-control, measured GM 12.40 dB at 3741 Hz, PM 39.95 deg at 1174 Hz, Ms = 1/sm = 1.729 python-control, fitted model GM 12.41 dB at 3735 Hz, PM 40.29 deg at 1166 Hz, Ms = 1/sm = 1.679 frf_margins, measured GM 12.37 dB at 3740 Hz, PM 40.08 deg at 1172 Hz, Ms = 1.721 butterfly at -10 % (5580 Hz): UNSTABLE (max |z| = 1.0046) butterfly at -5 % (5890 Hz): stable, GM 2.8 dB at 5903 Hz, Ms 3.75 butterfly at +5 % (6510 Hz): stable, GM 11.9 dB at 7323 Hz, Ms 1.68 butterfly at +10 % (6820 Hz): stable, GM 9.9 dB at 7408 Hz, Ms 1.78


Python output
(appears after the first live run)
Show code
Loading the source...Demo 3: the position error signal, runout, and the sensitivity function
How well a drive follows its tracks is judged by the PES logged during track following, summarized as $3\sigma$ in % of the track pitch. The log of drive D1 holds 50 revolutions recorded with the firmware controller (crossover 0.8 kHz, PM 44.7°, GM 15.9 dB, $M_s$ = 1.53 on the measured response). The repeatable runout (RRO) is locked to the disk, so averaging the PES at each servo sector over the revolutions estimates it, and the remainder is the non-repeatable runout (NRRO). The PES $3\sigma$ is 24.1 % TP (14.5 nm), with RRO 20.9 % and NRRO 12.1 %; the two add as $\sigma^2_{PES} \approx \sigma^2_{RRO} + \sigma^2_{NRRO}$. The mean current of -12.0 mA is the integral term holding the bias force.

PES with the firmware controller: the repeatable part and the spread of the non-repeatable part (simulated log).
The RRO in the PES is the track runout seen through the loop, $S(e^{j\omega T_s})\,r$ at each spindle harmonic, so dividing each harmonic by $|S_0|$ of the firmware loop recovers the runout of the track itself: 1.20 tracks at 1x (true 1.20), 0.13 at 2x, 0.055 at 3x. Below about 600 Hz the loop attenuates the runout; from the fifth harmonic on $|S_0| > 1$ and the runout is amplified, except at 44x-46x (5.3-5.5 kHz), where $|S_0|$ is 0.998-0.999, and from 92x (11 kHz) up. The NRRO spectrum divided by $|S_0|^2$ shows the disk-flutter peaks at 0.9 and 1.5 kHz.

Which runout the firmware loop follows and which it amplifies.
For a stable loop with no unstable open-loop poles the area under $\ln|S|$ over $0 \le f \le f_s/2$ is zero (Bode’s sensitivity integral; the computed values are -0.4 Np Hz for both loops). Raising the crossover from 0.8 to 1.2 kHz deepens the attenuation at the low harmonics and moves more amplification to 1-3 kHz and 6-9 kHz.

The waterbed effect: equal areas of ln|S| below and above 0 dB.
For a linear loop with the same disturbances, the PES with a new controller $C_1$ is the logged PES filtered by $S_1/S_0$, applied on the FFT of the whole-revolution log. With the controller of demo 2 the prediction from the log gives 13.2 % TP (RRO 9.6 %, NRRO 9.0 %), the same as a simulation with the disturbance model of the demo sidecar. A peak filter at the spindle frequency (+20 dB, $\zeta_z$ = 0.1) adds loop gain in a narrow band around 120 Hz, lowers $|S|$ there from 0.026 to 0.0025 and the 1x runout in the PES from 3.1 % to 0.3 %, for a PES $3\sigma$ of 11.5 %, at a cost of 1.1° of phase margin.
The interactive version designs the controller as in demo 2 for the chosen crossover and phase margin, optionally without the notch or with the peak filter, predicts the PES from the firmware log, and simulates it on the demo drive with the random sequences of the log. The simulation runs the loop once over the disturbance sequence before the logged pass, so that the slow closed-loop poles of the peak filter have settled. The module lists every crossover of the measured loop with its phase margin and, like the loop module, notes when the target asks a single lead stage for 90° or more. The defaults reproduce the C1 rows of the demo; switching the peak filter on reproduces the C1 + peak filter rows.
Interactive: PES with your controller
The button loads Python (Pyodide with numpy, scipy, matplotlib and python-control, about 40 MB on the first visit, cached afterwards) into this page; after that, changing a parameter re-runs the computation and redraws the figures. Until then the figures and numbers below are the output of the original demo script with the default parameters.
50 revolutions at 7200 rpm (spindle frequency 120 Hz), 300 sectors per revolution, Ts = 27.78 us firmware controller C0: K = 0.001426 A/track, lead 210/3049 Hz, integral 80 Hz, notch 6200 Hz C0 on the measured response: crossover 786 Hz, PM 44.7 deg, GM 15.9 dB, Ms 1.53 PES 3 sigma = 24.1 % TP: RRO 20.9 %, NRRO 12.1 % (RSS 24.1 %); 14.5 nm 3 sigma at 60 nm track pitch NRRO left in the RRO estimate: about 1.7 % 3 sigma (NRRO/sqrt(50)) mean current -12.0 mA (the integral term holds the flex-cable bias); mean PES 0.01 % TP harmonic in PES |S0| track runout (estimate, true) 1x 120 Hz 7.95 % 0.066 119.7 % TP (120.0 %) 2x 240 Hz 3.46 % 0.269 12.9 % TP ( 12.0 %) 3x 360 Hz 2.92 % 0.532 5.5 % TP ( 5.0 %) 4x 480 Hz 2.65 % 0.798 3.3 % TP ( 3.0 %) 5x 600 Hz 1.88 % 1.033 1.8 % TP ( 2.0 %) |S0| > 1 from 600 Hz on: harmonics 5x-43x and 47x-91x are amplified, not attenuated C0 (firmware) integral of ln|S| over 0..fs/2: -0.4 Np Hz (below 0 dB -1152, above +1152), max |S| 1.51 C1 (demo 2) integral of ln|S| over 0..fs/2: -0.4 Np Hz (below 0 dB -1791, above +1791), max |S| 1.68 C1 on the measured response: PM 40.1 deg, GM 12.4 dB, Ms 1.72 C1 + peak on the measured response: PM 39.0 deg, GM 12.3 dB, Ms 1.75 (peak filter 120 Hz, +20 dB, zeta_z 0.1) |S| at 120 Hz: C0 0.0664, C1 0.0258, C1 + peak 0.00253 PES, % of track pitch 3 sigma RRO NRRO 1x RRO amp C0 firmware (log) 24.1 20.9 12.1 7.95 C1 (predicted) 13.2 9.6 9.0 3.09 C1 (simulated) 13.2 9.6 9.0 3.09 C1 + peak filter (predicted) 11.5 7.1 9.1 0.30 C1 + peak filter (simulated) 11.5 7.1 9.1 0.31

Python output
(appears after the first live run)
Show code
Loading the source...Homework: a faster track-following loop for drive D2 (100 points)
Drive D2 is a 5400 rpm drive with 360 servo sectors per revolution (32.4 kHz) and a 75 nm track pitch, and its firmware controller has a crossover near 650 Hz. The homework starts from two simulated logs recorded with that controller, a swept-sine frequency response from 100 Hz to 15.5 kHz and a PES log of 50 revolutions, and asks for the identified actuator model, the highest crossover that keeps PM ≥ 35°, GM ≥ 6 dB and $M_s \le 2$ on the measured response, and the PES that the new controller and a peak filter would give. The full problem statements are in homework.md, and the starter script hw_starter.py is in the lab folder of the lab materials on GitHub; the logs are in its data/ folder. Clone the repository, or download it as a zip file.
- Frequency response and coherence (10 points; L20)
- Delay and rigid-body gain (10 points; L20, L21)
- Resonances and the modal fit (15 points; L21)
- Lead and integral without a notch (10 points; L18, L21, L24)
- Notch filter and the highest crossover (20 points; L21, L24, L26)
- The PES with the firmware controller (15 points; L20, L26)
- Predicted PES with your controller and a peak filter (10 points; L26)
- Engineering judgement (10 points)