loading...
running...
How to use
Top: the car scrolling along an elevated guideway. Bottom: a cross-section of one electromagnet under the steel guideway, with the gap exaggerated (use the zoom control), the suspension spring and the car body. Pick a preset or tune Kp, Kd, Ki and the amplifier lag. Press Kick the car or Rail step +4 mm ahead and watch the gap graph; raise the roughness and the speed to feel the ride. Try: (1) Too little Kp: it cannot hold at any current; (2) No damping versus Well tuned; (3) Slow amplifier to see the phase-lag instability; (4) Heavy payload: the integrator raises the current. Drag to orbit, wheel to zoom. Space pauses, R resets.
The guideway beam, steel rail, electromagnet with coils, springs, dampers and car body were modelled and baked in Blender; Three.js r160 moves them with the same gap-control model as the 2D lab and exaggerates the gap for visibility.
The science
How an electromagnetic-suspension (EMS) maglev holds itself up. A C-shaped electromagnet on the vehicle sits under a steel guideway. With coil current i and gap z the attractive force is, to good approximation,
F = k i² / z², k = μ0 N² A / 4 (N turns, pole area A, two pole faces)
Equilibrium needs F = M g, so Ieq = z0 √(M g / k). Linearising about it gives a force change ΔF = ki Δi + kz Δz with ki = 2 k Ieq / z0² (force per amp) and kz = 2 k Ieq² / z0³ (negative stiffness: a smaller gap pulls harder, a larger gap pulls less). The magnet alone is therefore unstable, with an open-loop pole at
s = ± √(kz / M) = √(2 g / z0) (about 44 rad/s for a 10 mm gap, independent of mass)
so a feedback loop is not optional: a small gap error grows by a factor e every 23 ms. The controller measures the gap and commands the current, icmd = Iff + Kp e + Kd de/dt + Ki ∫ e dt, through an amplifier modelled as a first-order lag τ (the coil inductance makes a fast current loop hard). With the lag neglected the closed loop is
M ζ'' + ki Kd e' + (ki Kp - kz) e = 0 ⇒ Kp > kz / ki is required, ωn = √((ki Kp - kz) / M)
Integral action moves the current to the new equilibrium when passengers board (the final gap error returns to zero). Too much lag removes the phase lead of the derivative term and the loop goes unstable even with a good Kp, Kd; the sensitivity graph shows how much the loop amplifies disturbances at each frequency (above 0 dB it amplifies).
The ride. The car body sits on a spring and damper (secondary suspension) above the magnet bogie, so the passengers feel guideway roughness through the gap controller and the suspension. The guideway irregularity is a sum of six sine components (wavelengths 1 to 41 m); at 100 m/s the 1.1 m component arrives at about 90 Hz. The body acceleration rms is an unweighted indicator, not an ISO 2631 comfort index. Levitation power is I²R of the coil; propulsion (a linear synchronous motor) is only represented as a speed profile and an aerodynamic drag power estimate (one 10 m² frontal section, Cd = 0.9).
Checks. (1) the full module at equilibrium on a smooth rail drifts less than 1e-8 m in 2 s; (2) a small gap error diverges open-loop at √(2g/z0); (3) the damped period of the closed-loop PD response matches the second-order formula above; (4) with a 10 % heavier car the PID returns to the reference gap and the current becomes Ieq√1.1.
Simplifications. One magnet module (not a full train); force law without fringing or saturation; coil inductance folded into the lag; current-source amplifier; no eddy-current damping in the rail; the vehicle moves only vertically here, lateral guidance and the linear motor are not simulated. Not affiliated with any maglev operator; numbers are illustrative.