AERO-330 · Lesson 11 of 12 · 23 min

Autopilots

Most of the Tern Block 2's flying hours will be spent with the autopilot engaged. A commuter pilot flying four or five short sectors a day in poor weather relies on it to hold altitude and heading in cruise, to fly the climb and descent, and to track the instrument approach down to the decision height. Hélène's team is designing the Block 2 autopilot around the stability and control models Arjun has built. This lesson explains how an autopilot is structured as nested loops, designs a pitch attitude hold and an altitude hold for the Tern in cruise, and simulates their response, including a limitation that shows why autopilots and autothrottles work together.

Inner and outer loops

An autopilot is built from the inside out. The innermost loops are attitude holds: pitch attitude through the elevator, bank angle through the ailerons, often with the yaw damper of Lesson 10 underneath. They are fast, with bandwidths of the order of 1 rad/s, because they work on the short-period and roll modes. Outer loops then command those attitudes to control slower quantities. Altitude hold commands pitch attitude; heading hold commands bank angle; navigation and approach modes command heading or bank to track a course, and pitch to track a glideslope. Each outer loop is designed to be several times slower than the loop inside it, so that it sees the inner loop as a nearly perfect follower of its commands. That separation of time scales is what makes the nested design work and keeps each loop simple enough to tune.

A block diagram. An h command enters an altitude law block with gains K_h and K_hd, which outputs theta_c to an attitude law block with gains K_th, K_i and K_q, which drives the elevator and the Tern dynamics. A green feedback path labeled theta and q, fast inner loop, returns from the dynamics to the attitude law. A blue path labeled h and climb rate, slow outer loop, returns to the altitude law.
The nested structure of an altitude hold. The outer altitude loop commands a pitch attitude; the inner attitude loop drives the elevator.

Pitch attitude hold

The pitch attitude hold moves the elevator in proportion to the attitude error, with pitch rate feedback for damping and an integral of the error to remove any steady offset:

\[\delta_e = K_\theta(\theta - \theta_c) + K_i\int(\theta - \theta_c)\,dt + K_q\,q\]

The signs follow from the Tern's elevator convention: positive elevator, trailing edge down, pitches the nose down, so an attitude below the command needs negative elevator. The integral term is not a luxury. Without it, a pure proportional law leaves the attitude short of the command, because as the aircraft pitches up and the speed begins to fall, the trim changes and the elevator must hold a small steady angle that only an error can produce. Arjun found this in his first simulation: with proportional gain alone, a 2 degree command settled at about 1.8 degrees and drifted as the phugoid developed. Adding the integral term with a modest gain removes the offset within a few seconds.

Tuning starts from the short-period model. The pitch rate gain adds damping, as in a pitch damper. The attitude gain sets how fast the loop responds. The integral gain is kept low enough that it does not add overshoot. For the Tern the team chose \(K_\theta = 1.5\), \(K_i = 0.6\) per second and \(K_q = 0.45\) seconds, all in radians of elevator per radian of error. The elevator command is limited to ±15 degrees, and in a real autopilot it would also be rate limited and smoothed.

Altitude hold

The altitude hold commands a pitch attitude from the altitude error and the climb rate:

\[\theta_c = K_h\,(h_c - h) - K_{\dot h}\,\dot h \qquad \dot h \approx u_0\,\theta - w\]

The climb rate term damps the approach to the new altitude, like the pitch rate term in the inner loop. The commanded attitude is limited, here to about ±4.6 degrees, so that a large altitude change produces a steady climb or descent rather than an aggressive pull. In practice an altitude preselect mode captures a new altitude by first flying a vertical speed and then switching to altitude hold close to the target, but the basic loop is the same.

A pitch attitude hold with proportional, integral and pitch rate terms, and an altitude hold around it, simulated on the linear longitudinal model of the Tern Block 2 with a fourth-order Runge-Kutta integrator.
# Pitch-attitude hold and altitude hold for the Tern Block 2 in cruise, simulated on the
# linear longitudinal model of Lesson 6 with a fourth-order Runge-Kutta integrator.
import math
m, Iyy, S, c, g, rho, u0 = 6500.0, 27000.0, 28.0, 1.73, 9.81, 0.909, 105.0
QS = 0.5 * rho * u0 ** 2 * S
CL = m * g / QS; CD = 0.028 + 0.039 * CL ** 2; CLa = 5.6; CDa = 2 * 0.039 * CL * CLa
Xu = -2 * CD * QS / (m * u0); Xw = (CL - CDa) * QS / (m * u0); Zu = -2 * CL * QS / (m * u0)
Zw = -(CLa + CD) * QS / (m * u0); Mw = -1.0 * QS * c / (Iyy * u0)
Mwd = -6.0 * (c / (2 * u0)) * QS * c / (Iyy * u0); Mq = -20.0 * (c / (2 * u0)) * QS * c / Iyy
Zde = -0.310 * QS / m; Mde = -1.362 * QS * c / Iyy          # per radian of elevator
de_max = math.radians(15)
def deriv(x, de, err):
    u, w, q, th, h, i = x
    wd = Zu * u + Zw * w + u0 * q + Zde * de
    return [Xu * u + Xw * w - g * th,
            wd,
            Mwd * wd + Mq * q + Mw * w + Mde * de,
            q,
            u0 * th - w,                                   # climb rate, small angles
            err]                                           # integral of the pitch error
def run(law, T=60.0, dt=0.01):
    x = [0.0] * 6; t = 0.0; hist = []
    while t < T:
        de, err = law(x)
        de = max(-de_max, min(de_max, de))
        k1 = deriv(x, de, err)
        k2 = deriv([a + dt / 2 * b for a, b in zip(x, k1)], de, err)
        k3 = deriv([a + dt / 2 * b for a, b in zip(x, k2)], de, err)
        k4 = deriv([a + dt * b for a, b in zip(x, k3)], de, err)
        x = [a + dt / 6 * (b1 + 2 * b2 + 2 * b3 + b4) for a, b1, b2, b3, b4 in zip(x, k1, k2, k3, k4)]
        t += dt; hist.append((t, x[:], de))
    return hist
def metrics(hist, idx, target):
    vals = [(t, x[idx]) for t, x, d in hist]
    t90 = next((t for t, v in vals if v >= 0.9 * target), None)
    peak = max(v for t, v in vals)
    last = [v for t, v in vals if t > vals[-1][0] - 5]
    ts = next((t for t, v in vals if all(abs(vv - target) < 0.05 * abs(target) for tt, vv in vals if tt >= t)), None)
    return t90, 100 * (peak - target) / target, sum(last) / len(last), ts
# inner loop: pitch attitude hold, elevator = K_th e + K_i (integral of e) + K_q q, e = theta - theta_c
K_th, K_i, K_q = 1.5, 0.6, 0.45
def pitch_law(thc):
    return lambda x: (K_th * (x[3] - thc) + K_i * x[5] + K_q * x[2], x[3] - thc)
th_c = math.radians(2.0)
h1 = run(pitch_law(th_c), T=20)
t90, ov, fin, ts = metrics(h1, 3, th_c)
mx = max(abs(d) for t, x, d in h1)
print(f"pitch hold, 2 deg step: 90% at {t90:.2f} s, overshoot {ov:.1f}%, settles (5%) {ts:.1f} s, max elevator {math.degrees(mx):.1f} deg")
# outer loop: altitude hold commands pitch attitude, theta_c = K_h (h_c - h) - K_hd hdot
h_c = 30.0; K_h, K_hd = 0.005, 0.012
def alt_law(x):
    hdot = u0 * x[3] - x[1]
    thc = max(-0.08, min(0.08, K_h * (h_c - x[4]) - K_hd * hdot))
    return pitch_law(thc)(x)
h2 = run(alt_law, T=60)
t90, ov, fin, ts = metrics(h2, 4, h_c)
peak = max(x[4] for t, x, d in h2)
print(f"altitude hold, 30 m step: 90% at {t90:.1f} s, peak {peak:.1f} m (no overshoot), within 5% from {ts:.1f} s")
print(f"   speed change at 60 s {h2[-1][1][0]:+.2f} m/s (no autothrottle), final altitude {h2[-1][1][4]:.1f} m")
for t_p in (5, 10, 20, 40):
    t, x, d = min(h2, key=lambda e: abs(e[0] - t_p))
    print(f"   t {t:4.0f} s: h {x[4]:5.1f} m, theta {math.degrees(x[3]):+.2f} deg, elevator {math.degrees(d):+.2f} deg")
Output
pitch hold, 2 deg step: 90% at 1.00 s, overshoot 9.7%, settles (5%) 5.8 s, max elevator 3.0 deg
altitude hold, 30 m step: 90% at 10.6 s, peak 29.4 m (no overshoot), within 5% from 15.5 s
   speed change at 60 s -1.77 m/s (no autothrottle), final altitude 29.4 m
   t    5 s: h  20.2 m, theta +1.13 deg, elevator +0.22 deg
   t   10 s: h  26.6 m, theta +0.47 deg, elevator -0.10 deg
   t   20 s: h  29.0 m, theta +0.25 deg, elevator -0.16 deg
   t   40 s: h  29.3 m, theta +0.19 deg, elevator -0.14 deg
Two time histories. Left: pitch attitude rises from 0 to a peak of about 2.2 degrees near 3.5 seconds and settles at the 2 degree command. Right: altitude change rises smoothly toward the 30 meter command, reaching about 29 meters by 20 seconds and staying just below 30 meters.
Simulated autopilot responses of the Tern Block 2 in cruise. The small altitude error remaining at 60 s comes from the speed lost without an autothrottle.

The pitch attitude hold reaches 90 percent of a 2 degree step in 1.0 second, overshoots by 9.7 percent and settles within 5 percent of the command in 5.8 seconds, using at most 3 degrees of elevator. The altitude hold reaches 90 percent of a 30 meter (98 ft) step in 10.6 seconds and stays within 5 percent from 15.5 seconds, with no overshoot. The table of values shows the attitude rising to about 1.1 degrees during the climb and then easing back. But at 60 seconds the aircraft is still 0.6 meters low and 1.77 m/s (3.4 kt) slow. Climbing traded kinetic energy for potential energy, and with the power unchanged nothing put it back. The phugoid, which the altitude hold suppresses as a height oscillation, has instead shifted into a slow loss of speed.

Why autopilots need autothrottles

Holding altitude with the elevator alone controls the flight path but not the energy. Every climb costs speed and every descent gains it, unless thrust changes. Older commuters relied on the pilot to adjust power; modern ones increasingly have an autothrottle or, on a hybrid-electric design like the Tern, an energy management function that commands the electric motors directly. It holds speed through power while the autopilot holds the path through the elevator, the division of labor that pilots learn as 'pitch for path, power for speed' on the approach. The alternative strategy, used in some climb and descent modes, swaps the roles: pitch holds the speed and power sets the climb rate. Lesson 12 returns to this energy view in the fly-by-wire control law.

Modes, monitoring and certification

A production autopilot has many modes: heading, navigation, vertical speed, altitude preselect and hold, flight level change, and approach with localizer and glideslope capture. The mode logic deciding which loops are active, and how they hand over smoothly, is often more complex than the control laws themselves, and confusion about the active mode has contributed to accidents. Each mode is displayed on a flight mode annunciator, and the design must make transitions clear and predictable. the FAA requires that the autopilot can be disengaged instantly from the control wheel, that it cannot command loads beyond the aircraft's limits, and that its failure modes, including runaway trim and hard-overs, are recognizable and recoverable in time. The certification flight tests include deliberately induced failures with a delay representing the pilot's recognition time.

Worked problem

Altitude loop gains

An altitude hold uses \(K_h = 0.005\) rad per meter. What pitch command does a 50 meter error produce, and what is the initial climb rate if the attitude follows it at 100 m/s with constant angle of attack?

Show solution
  1. \(\theta_c = 0.005 \times 50 = 0.25\) rad, which exceeds a 0.08 rad limit, so the command is 0.08 rad (4.6 degrees).
  2. Climb rate \(\approx u_0\theta = 100 \times 0.08 = 8.0\) m/s.

Answer: The limit turns a large altitude error into a steady climb of about 8 m/s, roughly 1600 ft per minute, rather than a sharp pull.

Worked problem

Separation of time scales

An inner pitch loop has a closed-loop time constant of about 0.6 s. Roughly how slow should the outer altitude loop be?

Show solution
  1. A common rule of thumb is a factor of 3 to 5 between loop bandwidths.
  2. So the altitude loop time constant should be about 2 to 3 s or longer; the Tern's design, at about 4 to 5 s, satisfies this.

Answer: If the outer loop were as fast as the inner one, the two would interact and the combined response could overshoot or oscillate.

Common mistakes

  • MistakeUsing a proportional attitude law with no integral term.

    InsteadA steady offset remains as trim changes; add integral action.

  • MistakeDesigning the outer loop as fast as the inner loop.

    InsteadKeep a separation of several times between loop speeds.

  • MistakeExpecting the elevator alone to hold both altitude and speed.

    InsteadPath and energy need elevator and power together.

  • MistakeNeglecting mode logic and annunciation.

    InsteadMode confusion is a known accident factor; transitions must be clear.

Summary and key terms

  • Autopilots are nested loops.
  • Fast inner loops hold pitch attitude and bank angle using elevator and ailerons with rate damping and integral action; slower outer loops command those attitudes to hold altitude, heading, courses and glideslopes.
  • Each outer loop is several times slower than the loop it commands.
  • An altitude hold that uses only the elevator trades speed for height, so an autothrottle or energy management function is needed to hold speed.
  • Mode logic, annunciation, disengagement and failure behavior are as important to certification as the control laws.
Inner loop
A fast feedback loop holding an attitude through a control surface.
Outer loop
A slower loop commanding the inner loop to control a path variable.
Integral action
Feedback of the accumulated error, removing steady offsets.
Altitude hold
An autopilot mode holding a selected altitude through pitch attitude commands.
Autothrottle
An automatic system controlling thrust to hold speed or path.
Flight mode annunciator
The display showing which autopilot modes are armed and active.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why are autopilots built as nested loops?

    Show answer

    Fast inner loops handle the short-period and roll dynamics; slower outer loops command them for path control.

  2. What did the integral term fix in the pitch hold?

    Show answer

    The steady attitude offset caused by changing trim.

  3. In the program, how slow is the aircraft at 60 s after the 30 m step?

    Show answer

    About 1.77 m/s slower than trim.

  4. What does 'pitch for path, power for speed' mean?

    Show answer

    Elevator controls the flight path while thrust controls speed.

  5. Why limit the commanded pitch attitude?

    Show answer

    So large altitude changes become steady climbs, not sharp pulls.

  6. Name a certification requirement for autopilots.

    Show answer

    Instant disengagement from the control wheel (or recoverable failure modes).

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz