← Projects/P-03

PID speed control of an autonomous SUV

In the first of five mini-projects for ME 527 Modern Control Systems at Embry-Riddle, I had to design the speed controller of an autonomous SUV in a Simulink model supplied by the course, changing nothing but the P, I and D constants. The controller I derived on a simplified model met every requirement that model could check, then overshot by 17.7 % on the full model. This is how I found out why and fixed it.

Course
ME 527 Modern Control Systems, Mini-Project 1 of 5, Embry-Riddle
Year
Sep 2026
Team
Individual
Model
Simulink vehicle model supplied by the course
Stack
MATLAB / Simulink R2026a · Control System Toolbox · Powertrain Blockset · Simscape Electrical
Result
Graded 10/10 · all four requirements met · Kp = 250, Ki = 0.12, Kd = 15
Fig. 01Final controller (Kp = 250, Ki = 0.12, Kd = 15) on the full model: acceleration test with the peak zoomed (30.2274 m/s against the 30.30 limit), drive-cycle tracking at 55.05 mpg, and a trace error that peaks at 0.7014 m/s.
0.70 m/s
max drive-cycle trace error (limit 1.0)
55.05 mpg
fuel economy over the cycle (limit > 50)
17.7 → 0.76 %
overshoot, first design → final (limit 1 %)
14
full-model runs of ~19 min each, baseline check included

01The problem

The course supplied a Simulink model of the longitudinal dynamics of a 1,628 kg SUV. It runs two tests at once, each with its own copy of the PID and the vehicle but sharing the same three gains: the UDDS city cycle, where the car has to follow the FTP-75 speed trace for 1,400 s, and a 0–30 m/s acceleration test. Only the P, I and D constants could change. The controller had to meet four requirements:

  • maximum trace error ≤ 1.0 m/s on the drive cycle
  • fuel economy > 50 mpg
  • steady-state error ≤ 0.01
  • maximum overshoot ≤ 1 %

One full run takes about 19 minutes, so trying gains at random was never an option. Before trusting anything I ran the model with the gains it ships with (P = 1, I = 0, D = 0) and reproduced the four values printed in the assignment: 9.862 m/s, 66.48 mpg, 0.2251 and 0 %. Reading the blocks also showed that two of the metrics are normalized: the steady-state error is |v − 30| / 30, and the overshoot limit means the car may never exceed 30.30 m/s.

Fig. 02The Simulink model supplied with the course, after the final run: gains on the left, drive cycle (top) and acceleration test (bottom), each with its own copy of the PID and the vehicle, and the four requirement displays on the right.

02A plant model from eight pedal steps

Inside the Vehicle Dynamics block, the controller output is a signed pedal command: two saturations split it into accelerator (0 to 100 %) and brake (0 to −100 %). I copied the block into a separate open-loop model and drove it with eight constant pedal steps of 250 s each.

The static map is clearly non-linear: the gain v/u falls from 4.22 to 1.59 (m/s)/% across the range, a factor of more than 2.5. Because the acceleration test ends at 30 m/s, I identified the plant at the pedal that holds exactly that speed, u* = 13.38 %, and fitted a first-order model by least squares over the whole transient:

  • G(s) = 2.2506 / (22.05 s + 1), in m/s of speed per % of pedal.
  • The 63.2 % rule gives τ = 19.32 s, which is close. A first-order-plus-delay fit returned a negative delay and was discarded.
  • The road-load coefficients alone would give τ ≈ 1,200 s. Most of the damping comes from tractive force falling with speed at a fixed pedal, which is a lookup table inside the powertrain. That is why K and τ had to be measured rather than derived.
Fig. 03Open-loop static map with the 30 m/s operating point (left), and the eight pedal-step responses against their first-order fits (right).

03A design that passed on paper

I turned each requirement into one design decision, so that no gain was picked by trial and error:

  • Steady-state error → integrator. A type-1 loop has zero steady-state error to a step, so this requirement is met by construction.
  • Overshoot → zero placement. Putting the PI zero on the plant pole (Ki/Kp = 1/τ) cancels it. The closed loop becomes exactly first order: 0 % overshoot, 90° phase margin, infinite gain margin.
  • Trace error → bandwidth. The drive cycle is made of straight segments, so locally it is a ramp, and the tracking error is the ramp slope times the closed-loop time constant. With the steepest UDDS slope of 1.4752 m/s², the 1.0 m/s limit requires a time constant under 0.678 s. I chose 0.40 s.
  • No derivative. On a first-order plant it only adds a zero that brings overshoot back, and the model's derivative block is unfiltered.

That gave Kp = 24.49, Ki = 1.111, Kd = 0. On the simplified model the trace error was 0.5901 m/s, exactly what the formula predicts, and the overshoot was 0.0000 %. Fuel economy cannot be evaluated on a linear model, so that one had to wait for the full run.

On the full model, two of the four requirements failed. The trace error was 1.63 m/s, and the overshoot was 17.7 %, eighteen times the limit: the car shot up to 35.3 m/s and took more than a minute to come back down. Fuel economy (55.95 mpg) and steady-state error passed.

Fig. 04The first design on the full model: 17.7 % overshoot with a slow, one-sided decay (top), and trace error beyond ±1 m/s, largest while braking (bottom). The simplified model had predicted 0 % and 0.59 m/s.

04Why the full model said no

The shape of the failure pointed to the cause. A slow, one-sided return to 30 m/s is not an under-damped oscillation; it is integrator windup. The PID block supplied with the model is a bare 1/s integrator and a raw Δu/Δt derivative, with no anti-windup and no filter. From standstill the error is 30 m/s, so the controller asks for about 735 % pedal. The actuator sits on its ±100 % stop for the whole launch while the integrator keeps charging, and the only way to discharge it is to overshoot.

To test that, I added only the ±100 % pedal limit to the simplified model and changed nothing else. The predicted overshoot went from 0 % to 4.8 %: not the full 17.7 %, but the same mechanism.

The trace error was a separate problem that the simplified model also missed: the plant gain is not constant. I had designed with the secant gain of the full 0–30 m/s step (2.25), but near 30 m/s the local slope of the static map is only about 1.09 (m/s)/%, and the largest errors on the cycle appeared while braking. A higher Kp gave the loop the authority the linear design had assumed, and fixed it (step 1 below).

A straight-line fit through the redesign runs on the full model gives a simple relation that explains the failure: overshoot ≈ 0.88 % + 419 · Ki/Kp. Pole-zero cancellation fixes Ki/Kp at 1/τ = 0.0454, about 95 times the ratio the final design ended up with. Derivative action was not enough on its own either: two early runs with Kd = 39.2 and 68.6, Kp around 50 and Ki/Kp still near the cancellation value overshot by 17.4 % and 9.7 %.

Fig. 05The PID block as supplied with the course model: a bare integrator and an unfiltered derivative, with no anti-windup.
Fig. 06Same simplified model, same gains: adding only the ±100 % pedal limit raises the overshoot from 0 % to 4.8 %. Below, the pedal sits on its stop at the start of the launch while the integrator charges.

05Redesign: break the cancellation

The fix was to break the pole-zero cancellation on purpose: keep Kp high for tracking authority and cut Ki far below the cancellation value. The steady-state requirement still holds, because the integrator only has to remove the error by the end of the 1,400 s run. To avoid spending 19 minutes on every guess, I re-fitted the simplified model to the five full-model runs I had at that point (K = 0.95, τ = 30 s, plus the pedal clamp). It reproduced the full model's overshoot to within 1.5 % RMS and ran in about a second, so from then on I used it to screen gains before committing to a full run.

  • Step 1: raise Kp, drop Ki. At Kp = 120, Ki = 0.66 the trace error fell from 1.63 to 0.77 m/s and the overshoot from 17.7 % to 3.2 %. This was the most effective single change.
  • Step 2: drop Ki further. With Ki cut to 0.12–0.25 (Ki/Kp down to 0.001) the overshoot came down to between 1.2 and 1.6 %, but no run without derivative got below 1.18 %: something other than windup was setting a floor.
  • Step 3: add derivative for the last fraction. Zooming in on the peak showed a short spike as the car crossed 30 m/s, not the windup hump. With Kp = 250 the pedal stays saturated until the error is under 0.4 m/s; by then the car is at 29.6 m/s and still accelerating at about 3 m/s², and the powertrain cannot cut torque instantly. A derivative term lets the pedal come off earlier. At Kp = 120, Kd = 15 and 30 brought the overshoot to 1.07 and 1.06 %; at Kp = 250 it went under the limit.

The final gains are Kp = 250, Ki = 0.12, Kd = 15: about ten times the first Kp and a ninth of its Ki. Results on the unmodified model after a full run:

  • Trace error 0.7014 m/s (limit 1.0, 30 % margin)
  • Fuel economy 55.05 mpg (limit 50)
  • Steady-state error 0.000104 (limit 0.01)
  • Overshoot 0.7579 %: the peak reaches 30.2274 m/s, under the 30.30 m/s limit

Fourteen full-model runs were enough, the baseline check included. Fuel economy was never the binding requirement: every tuned run landed between 53.9 and 56.0 mpg. The shipped gains reach 66.5 mpg only because they track the cycle so badly that the car never has to accelerate hard.

Fig. 07Left: overshoot against Ki/Kp for the 13 tuned full-model runs, from the first design (top right) to the final one, g250 (bottom left). Right: fuel economy against trace error; only the shipped baseline (far right) is far from the 54–56 mpg cluster.