← Engineering laboratories
CONTROL SYSTEMS / CLOSED LOOP

Autopilot PID Laboratory

Give the airplane an altitude. Teach the controller how to get there.

ALTITUDE HOLD
SIDE VIEW · amber elevator overlay is schematic
ACTUAL ALTITUDE3,000 ft
VERTICAL SPEED0 ft/min
ELEVATOR0.0°
Instant ±600 ft/min disturbance

Altitude response

Actual Target

Last 60 simulated seconds · vertical axis automatically scales

What is the controller asking for?

P0°Respond to error now
I0°Remember past error
D0°Resist altitude change
Σ0°Requested elevator

Servo within limits

Try three experiments

1. Chase too hard. Choose Hunting. Watch the elevator reverse after the aircraft passes the target. Increase D to tame the oscillation.

2. Give I a job. Set the steady disturbance to +2 ft/s², then set I to zero. Watch the remaining altitude error. Add a little I to remove it.

3. Find the hardware limit. Reduce elevator travel and servo speed. Change the target. Compare recovery with anti-windup on and off.

Model, units & limitations

This is a deliberately simplified, single-axis control-system demonstration, not a model of any aircraft or certified autopilot. Altitude error drives elevator directly through a PID controller. Real systems typically use cascaded altitude, vertical-speed and attitude loops, mode logic and envelope protection.

The model uses elevator-to-pitch lag (0.8 s), vertical acceleration = 1.2 × pitch proxy − 0.35 × vertical speed + disturbance, and integrates vertical speed to altitude. Pitch proxy and elevator are in illustrative degrees; altitude is feet, time is seconds. The displayed pitch and altitude motion are exaggerated. The airplane is a reused, AI-generated realistic Cessna-style image, not a photograph or a dimensionally exact Cessna 182. The amber moving elevator overlay is schematic; the underlying image is not a deforming airframe. No airspeed, thrust, energy, stall, trim, flight envelope or ground collision is modeled. Positive elevator means trailing-edge up, producing a nose-up response.

P = Kp × altitude error; I = Ki × accumulated altitude error; D = −Kd × vertical speed. D acts on the measured altitude to avoid a derivative kick when the target changes. Gain units are degrees/foot, degrees/(foot·second) and degrees·second/foot. Servo travel and rate are limited; the integral has an additional numerical bound. Presets reset the experiment to 3,000 ft with a 3,100 ft target. Gust buttons add vertical speed instantly. The steady disturbance adds vertical acceleration continuously.

For learning control behavior only. Never use these gains for aircraft, flight operations or hardware tuning.