2. Modeling
Modeling physical systems is the foundation of engineering design: once you understand a system’s governing dynamics, you can simulate its behavior, design model-based controllers, and evaluate performance before touching hardware.
Lecture videos
Section titled “Lecture videos”Slides
Section titled “Slides”PowerPoint handouts: Dark · Light
Interactive example
Section titled “Interactive example”HDD VCM actuator resonance
Section titled “HDD VCM actuator resonance”The example builds a transfer-function model of a hard-disk-drive voice-coil-motor (VCM) actuator as a sum of second-order resonance modes — the actuator arm’s flexible-body dynamics on top of its rigid-body motion. Each mode in omega_vcm/zeta_vcm/kappa_vcm carries its own resonance frequency, damping ratio, and gain contribution, fit from measured frequency-response data; Sys is their sum.
The script then evaluates that model’s frequency response over 18-25 kHz and finds the peak magnitude, which lands on the actuator’s dominant ~21 kHz resonance. The slider below lets you change the damping ratio of that specific mode (zeta_vcm[8]) and see how the peak gain of the resonance shifts — less damping means a sharper, higher peak, which is exactly the kind of mode a control designer has to design around (or notch out) when closing the servo loop.
import numpy as npimport control as ctimport jsonimport warningswarnings.filterwarnings("ignore")
omega_vcm = np.array([0, 5300, 6100, 6500, 8050, 9600, 14800, 17400, 21000, 26000, 26600, 29000, 32200, 38300, 43300, 44800]) * 2 * np.pikappa_vcm = np.array([1, -1.0, 0.1, -0.1, 0.04, -0.7, -0.2, -1.0, 3.0, -3.2, 2.1, -1.5, 2.0, -0.2, 0.3, -0.5])zeta_vcm = np.array([0, 0.02, 0.04, 0.02, 0.01, 0.03, 0.01, 0.02, 0.02, 0.012, 0.007, 0.01, 0.03, 0.01, 0.01, 0.01])zeta_vcm[8] = float(param_value)Kp_vcm = 3.7976e+07
Sys = ct.TransferFunction([], [1])for i in range(len(omega_vcm)): Sys = Sys + ct.TransferFunction(np.array([0, 0, kappa_vcm[i]]) * Kp_vcm, np.array([1, 2 * zeta_vcm[i] * omega_vcm[i], omega_vcm[i] ** 2]))
f = np.logspace(np.log10(18000), np.log10(25000), 3000)w = f * 2 * np.piresp = ct.frequency_response(Sys, w)mag_db = 20 * np.log10(resp.magnitude)idx = int(np.argmax(mag_db))json.dumps({"resonance_freq_hz": float(f[idx]), "peak_gain_db": float(mag_db[idx])})HDD VCM actuator resonance (mcimp/codes/modeling/hddvcm.py)
Click "Run" to execute.