Magnetic levitation: an unstable plant

The plant falls (or jumps) on its own. What does that demand of the controller, and does it need anything beyond PID?

🧲 Magnetic levitationPID is the answer5 guided steps
Step 1
Step 1 of 5

The situation

A 2 kg armature hangs under an electromagnet at a 15 mm gap. The mechanical view shows why it can't stay there on its own: where the magnet's pull equals the weight, a little further down the pull is weaker and a little closer it is stronger. Linearized, the gap has a pole at +36 rad/s: any error doubles in 20 ms. The amplifier answers in 3 ms, and the controller runs every millisecond.

Try auto-tune on the PID: it refuses. Every tuning rule assumes a stable or integrating plant.

Step 2
Step 2 of 5

A PID designed by hand

The derivative is what stabilizes it: P alone makes a spring with no damping. Place the closed-loop pair well above 36 rad/s: Kc=4K_c = 4, Td=20T_d = 20 ms (filtered), and a slow integral, Ti=150T_i = 150 ms, for the weight it has to carry. With the setpoint weight at its default b=1b = 1, every gap change kicks the coil: the armature overshoots by more than its step, 130 %. On the mismatch test it lands on the pad.

Running the tests…
Step 3
Step 3 of 5

Setpoint weighting

Put only 30 % of the setpoint into the P term (b=0.3b = 0.3; the D term already works on the measurement only). The loop's stability is unchanged; only the setpoint response is. Gap changes now settle in about 0.2 s without overshoot, half a kilogram of extra load dips the gap by 2 %, and the mismatch test passes.

The peak sensitivity is 3.1, high by the usual standards. For an unstable plant there is a lower limit on how robust the loop can be, set by the unstable pole and the delays, and this is near it.

Comparing in this step:PID, b = 1PID, b = 0.3
Running the tests…
Step 4
Step 4 of 5

State feedback by pole placement

The model is exactly what an unstable plant needs designed from anyway. Place the dominant pair at ωn=60\omega_n = 60 rad/s, ζ=0.8\zeta = 0.8; a Kalman filter estimates the falling speed (no differentiating of a noisy gap) and the extra load from the current it takes.

It settles about twice as fast (0.06–0.13 s), with a little more margin (Ms 2.4), and overshoots more on gap changes: up to 9 %, and 26 % on the mismatch test, because the setpoint feedforward assumes the magnet is as strong as it was. Against a PID tuned as hard (see Compare controllers) the speed advantage shrinks to about 15 % less error, and close to the magnet it has less margin, not more.

Comparing in this step:PID, b = 0.3State feedback
Running the tests…
Verdict
Step 5 of 5

Verdict

PID is fine here: PD plus a slow integral, designed from the model, with a setpoint weight. State feedback is no clear win on one axis.

What the unstable plant teaches:

  • The loop has a minimum speed: it has to be faster than the unstable pole.
  • So the hardware sets the limits: the controller cycle, the amplifier, the sensor. Real magnetic bearings run at 10–20 kHz.
  • No tuning rule applies: design from the model, by pole placement or on the Bode plot.
  • The gain moves with the setpoint (the pole runs from 50 rad/s at 8 mm to 30 at 22 mm), and saturating the amplifier at the wrong moment drops the load. Range, limits and trips matter as much as the tuning.

Everything in this case, through every test

Running the tests…