Model Predictive Control — Engineering Reference
1. At a glance
Model Predictive Control (MPC) — also called receding-horizon control — is a feedback strategy that, at every sample instant, solves a finite-horizon open-loop optimal control problem using an explicit plant model, applies only the first element of the computed input sequence, then discards the rest and re-solves at the next sample with the freshly measured state. The “predict, optimize, act, repeat” loop is what gives MPC its distinguishing property: it is the only mainstream control framework that handles hard input and state constraints, MIMO interactions, and multi-step prediction natively — as part of the formulation, not as post-hoc patches like anti-windup or override selectors layered on top of PID.
MPC was born in the late 1970s at Shell (Cutler & Ramaker’s Dynamic Matrix Control, DMC) and Adersa (Richalet’s IDCOM) for refinery applications where dozens of interacting variables, equipment limits, and economic targets had to be coordinated. Forty-five years later there are roughly 5,000 industrial MPC installations in refining, petrochemicals, pulp & paper, cement, and similar slow-process industries — DMCplus and Profit Controller alone account for thousands of seats. Embedded MPC is the newer growth front: with quadratic-program solvers now running in hundreds of microseconds on Cortex-M / TI C2000 / automotive AURIX hardware, MPC has spread into motor drives, EV powertrain torque-vectoring, autonomous-vehicle path tracking, building HVAC, drone trajectory control, and prosthetics. The cost calculus has flipped — the question used to be “can we afford the compute?” and is now “can we afford not to handle constraints in the formulation?”
Where it sits in the control stack: above classical PID (which dominates loop-level regulation), beside LQR (which it generalizes), and below mission-level planning. MPC is the natural mid-level controller that turns a higher-level reference into actuator commands while respecting plant physics.
2. Why it matters — and when not to use it
MPC earns its keep when at least one of the following is true:
- Hard constraints are routinely active. Actuator saturation, slew limits, output specs, safety limits, equipment-survival envelopes. PID handles these only with anti-windup hacks, range-limit overrides, and gain scheduling — all fragile.
- The plant is genuinely MIMO with significant cross-coupling. Decoupled SISO PID loops fight each other; centralized MPC sees the interaction and pre-compensates.
- Future references or disturbances are knowable. A trajectory-tracking robot knows its waypoints. An HVAC system knows the schedule. A grid-tied converter knows the next AC half-cycle. MPC consumes preview information natively — PID cannot.
- There is a non-trivial economic objective beyond tracking. Maximize throughput at quality, minimize energy at comfort, minimize fuel at trip time.
- Dynamics are highly multi-step. Long deadtimes, integrators, non-minimum-phase responses where a one-step PID law mis-prioritizes.
MPC is not justified when: the plant is a single well-behaved SISO loop, PID has worked for thirty years, the field engineers are not trained to tune a horizon and weight matrix, or the embedded compute envelope cannot guarantee the worst-case solver latency. PID still controls > 90 % of industrial loops and is the right answer for most of them.
3. First principles — the optimization at each sample
At sample time k, given the current state estimate x_k and (optionally) a future reference trajectory r, MPC solves:
min_{u_0..u_{N-1}} Σ_{i=0}^{N_p-1} [ (x_i - r_i)ᵀ Q (x_i - r_i) + u_iᵀ R u_i + Δu_iᵀ S Δu_i ]
+ (x_{N_p} - r_{N_p})ᵀ P (x_{N_p} - r_{N_p})
s.t. x_{i+1} = A x_i + B u_i + E d (model)
u_min ≤ u_i ≤ u_max (input box)
Δu_min ≤ u_i - u_{i-1} ≤ Δu_max (rate limits)
y_i = C x_i, y_min ≤ y_i ≤ y_max (output / state box)
x_0 = x̂_k (current measurement)
The decision variables are the input sequence {u_0, …, u_{N_c−1}} (with u held constant from N_c to N_p — the so-called blocking assumption). After solving, the controller applies only u_0 and discards u_1 through u_{N_c−1}. Next sample, the entire problem is re-formulated with the new measurement x_{k+1} and re-solved.
Key insight — MPC equals LQR in the limit. If the horizon N_p → ∞, there are no constraints, and P is chosen as the unique positive-definite solution of the discrete-time algebraic Riccati equation (DARE):
P = AᵀPA − AᵀPB(R + BᵀPB)⁻¹BᵀPA + Q
then the receding-horizon solution coincides exactly with the infinite-horizon LQR optimal feedback u = −K x, where K = (R + BᵀPB)⁻¹ BᵀPA. Unconstrained MPC is just LQR re-cast as an online QP; the value of MPC is what happens when constraints become active or when N_p is finite. This DARE-derived P is also the natural choice of terminal cost for stability proofs of constrained MPC — it captures the cost-to-go of the unconstrained tail beyond the horizon.
Prediction horizon vs control horizon. N_p is how far ahead the cost function looks; N_c (≤ N_p) is how many distinct decision variables are kept in the QP before forcing u_i = constant. Typical industrial settings: N_p = 30–60, N_c = 5–10. Shorter N_c reduces solve time at the cost of some optimality on the tail.
The receding horizon is what makes it feedback. A pure open-loop optimization with horizon N_p would be hopelessly fragile to disturbance and model mismatch. Re-solving every sample, using the freshly measured state as the new initial condition, converts the open-loop optimization into closed-loop feedback. This is why MPC can tolerate model error that would destroy a purely feedforward trajectory.
Cost-function anatomy. Three quadratic terms appear in almost every linear MPC:
- State / output tracking — (x_i − r_i)ᵀ Q (x_i − r_i) penalizes deviation from the reference. Q is positive-semidefinite; zero rows turn off tracking for states that don’t matter.
- Input cost — u_iᵀ R u_i penalizes raw actuator effort. R is positive-definite to keep the QP strictly convex.
- Rate cost — Δu_iᵀ S Δu_i (where Δu_i = u_i − u_{i−1}) penalizes actuator motion. This is what produces smooth, mechanically friendly trajectories and is the closest analogue to a derivative term in classical control.
Cross-terms (x_iᵀ N u_i) appear in optimal-control derivations from continuous-time LQR with non-square weighting but are rarely set non-zero by hand.
Equality versus inequality constraints. Equalities are reserved for the model dynamics and any conservation laws (mass balance, KVL/KCL in power MPC, kinematic loops in robotics). Inequalities encode the physical / engineering / regulatory limits: actuator boxes, rate limits, output specs, safety envelopes. The QP’s complexity scales with the inequality count, not the equality count (equalities collapse into a substitution at problem build time).
4. MPC variants — a taxonomy
| Variant | Problem class | Typical solve time | Where used |
|---|---|---|---|
| Linear MPC (LMPC) | Convex QP | 10 µs – 10 ms | Embedded motion control, refinery DMC, drives |
| Hybrid MPC | MILP / MIQP | 10 ms – 1 s | Switched converters, gear-shift logic, HVAC mode selection |
| Nonlinear MPC (NMPC) | NLP (often SQP) | 1 ms – 10 s | Robot manipulators, aerospace, batch chemistry |
| Robust MPC (tube, scenario, min-max) | QP with constraint tightening or stochastic LP | 1× – 5× LMPC | Plants with bounded uncertainty, safety-critical |
| Stochastic MPC | Chance-constrained QP / SOCP | 10× LMPC | Smart-grid, finance-adjacent, drones with noisy sensors |
| Economic MPC | NLP with profit/cost objective | comparable to NMPC | Process industries pursuing direct dollar optimization |
| Explicit MPC | Offline multi-parametric QP → lookup PWA function online | 1 µs – 100 µs online | Embedded with no room for online solver (≤ ~10 states) |
Linear MPC is by far the most deployed. The model is LTI (or LTV via successive linearization), the cost is quadratic, the constraints are polyhedral, and the per-sample problem is a strictly convex QP. Off-the-shelf solvers handle it well.
Nonlinear MPC keeps the full nonlinear plant model. The per-sample problem is an NLP solved by sequential quadratic programming (SQP) or interior-point. Diehl’s real-time iteration (RTI) scheme — solve one QP per sample using last sample’s linearization, never iterate to NLP convergence — bridges the gap to embedded NMPC and is the basis of acados. RTI on a Cortex-A53 routinely handles 20-state quadrotor NMPC at 100 Hz.
Explicit MPC (Bemporad/Morari/Dua/Pistikopoulos 2002) recognizes that the QP solution is a piecewise-affine function of the parametric initial state x_0. Pre-compute that PWA partition offline; online the controller does a point-location query and a matrix-vector multiply. For ≤ ~10 states and short horizons this is faster than any online QP, with bounded worst-case time. Beyond that the partition explodes combinatorially and the lookup memory becomes infeasible.
Finite-Control-Set MPC (FCS-MPC). A specialty branch that has revolutionized power-electronic converter control since ~2009 (Cortés/Kazmierkowski/Kennel/Quevedo/Rodríguez 2008). Rather than treating the switching duty cycle as a continuous decision variable, FCS-MPC enumerates the discrete switching states of the converter (a 3-phase 2-level inverter has 8 states; a modular multilevel converter can have thousands) and evaluates the cost for each over a short horizon (N_p = 1 or 2 typical). The switching state that minimizes cost is applied directly — no PWM modulator required. The QP collapses to an enumerative search. Achieves sub-cycle current control on standard motor drives at 10–40 kHz on TI C2000 hardware.
Robust MPC acknowledges bounded model uncertainty Δ. Tube-MPC (Mayne et al. 2005) plans a nominal trajectory and certifies that the uncertainty tube around it remains in the feasible set. Scenario-based MPC samples disturbance realizations and demands feasibility for all of them. Min-max MPC plays a game against the worst-case disturbance. All come at multiplicative computational cost.
Stochastic MPC allows occasional probabilistic constraint violation (chance constraints: P[y ≤ y_max] ≥ 1 − α). Tighter than worst-case robust; appropriate when disturbances are unbounded but well-characterized.
Economic MPC drops the tracking-error premise entirely. The stage cost is the dollar cost — fuel burn, electricity price, throughput value. Tracking emerges only insofar as the setpoint coincides with the economic optimum. Used in refining (Profit Controller’s “rigorous” mode) and in modern building HVAC.
Distributed and hierarchical MPC. Large plants — refinery complexes, smart grids, multi-vehicle platoons — do not fit a single monolithic MPC. Distributed MPC (DMPC) decomposes the problem across subsystems that exchange predicted trajectories or Lagrange multipliers each sample (Camponogara/Jia/Krogh/Talukdar 2002, Scattolini 2009). Hierarchical MPC runs a slow upper-level economic optimization that hands setpoints to faster lower-level tracking MPCs. Both architectures preserve some of MPC’s coordination benefit while keeping individual QP sizes tractable.
Learning-based and adaptive MPC. Gain-scheduled MPC interpolates a family of pre-tuned linear MPCs across operating points (the everyday approach in aerospace and automotive). Adaptive MPC updates the model online from input/output data (recursive least squares, Kalman parameter estimation). Learning-based MPC layers a Gaussian process or neural-network residual on top of a nominal model to capture the unmodeled gap (Hewing/Kabzan/Zeilinger 2019, the basis of HILO-MPC). The frontier — safe learning-based MPC — combines a learned model with robust constraint tightening so that exploration cannot violate safety limits.
5p. Theory — solving the QP and proving stability
Standard-form QP
Stack the predicted state and input sequences and substitute the model into the cost. The result is:
min_z ½ zᵀ H z + fᵀ z s.t. A_in z ≤ b_in, A_eq z = b_eq
where z contains the future inputs (and slack variables for soft constraints), H is positive-definite (when R ≻ 0), and the inequalities encode input, rate, and output constraints. The QP has dimension on the order of (input count) × N_c — say 30–200 variables for typical embedded MPC, 500–5000 for refinery MPC.
QP solver families
| Family | Examples | Strength | Weakness |
|---|---|---|---|
| Active-set | qpOASES, DAQP | Excellent warm-start between samples; near-O(1) when active set doesn’t change | Worst-case super-linear; no global iteration bound |
| Interior-point | OSQP (with ADMM front-end), HPIPM, FORCES Pro IP | Predictable iteration count; robust to ill-conditioning | Cold-start cost; harder to warm-start |
| First-order / ADMM | OSQP, FBstab, SCS | Tiny memory; division-free variants for FPGA | Slow tail convergence; modest accuracy |
| Gradient projection | GPAD, FGM | Smallest code-size; bare-metal friendly | Only box-constrained or simple polyhedra |
OSQP (Stellato/Banjac/Goulart/Bemporad/Boyd 2020) has become the de-facto open-source workhorse — BSD-licensed, embeddable C code-gen, sub-millisecond on Cortex-M7. qpOASES (Ferreau/Kirches/Potschka/Bock/Diehl 2014) remains the active-set choice when warm-starting dominates. HPIPM (Frison/Diehl 2020) is the fastest embedded interior-point for the structured QPs that arise in MPC, exploiting the band/block-banded Hessian.
Real-time iteration (RTI)
For NMPC, don’t iterate to NLP convergence inside one sample. Instead:
- Use the previous sample’s solution as the linearization point.
- Linearize the dynamics and cost about that trajectory.
- Solve the resulting QP exactly once.
- Apply u_0; advance; relinearize next sample.
The closed loop iterates the SQP step across samples rather than within a sample. As long as the per-sample QP completes inside one sample and the linearization is updated reliably, RTI converges to the true NMPC solution as the plant approaches steady state. This is the algorithmic core of acados and is what enabled the explosion of embedded NMPC since ~2017.
Stability and recursive feasibility
Closed-loop stability of MPC is not automatic. The textbook sufficient conditions (Mayne/Rawlings/Rao/Scokaert 2000 Automatica — the canonical paper):
- Terminal cost P chosen so that the terminal stage cost upper-bounds the cost-to-go of an admissible terminal controller.
- Terminal set X_f — a positively invariant set for the terminal controller, in which all state constraints are satisfied.
- Terminal constraint x_{N_p} ∈ X_f imposed in the QP.
Under these, the value function V_k = J*(x_k) is a Lyapunov function: V_{k+1} ≤ V_k − ℓ(x_k, u_k), so V → 0 and the closed loop is asymptotically stable. Recursive feasibility (if feasible at k, feasible at k+1) follows from the same invariance argument.
In practice, refining and petrochem MPC vendors do not prove stability on real plants. They tune until the controller doesn’t oscillate, use generous horizons, and rely on soft constraints plus operator override. Formal stability proofs matter where the controller must be certified — automotive, aerospace, medical — and where insurance / regulation requires it.
Region of attraction
Even with stability conditions satisfied, MPC’s region of attraction (the set of initial states from which the closed loop converges) is finite. It equals the N_p-step controllable set into the terminal region X_f. Increasing N_p enlarges the region of attraction monotonically; this is the practical justification for long horizons even when shorter ones would track the reference adequately. Computing the region of attraction explicitly (via reach-set algebra in tools like MPT3 — the Multi-Parametric Toolbox) is a key validation step for safety-critical MPC.
6p. Tuning the MPC — practitioner cheatsheet
| Parameter | Symbol | Rule of thumb | Failure mode if wrong |
|---|---|---|---|
| Sample time | T_s | 5–10× faster than dominant time constant | Aliasing of fast modes; control-loop ringing |
| Prediction horizon | N_p | N_p · T_s ≈ 2–3× longest open-loop settling time | Short-sighted control; instability |
| Control horizon | N_c | 5–10, or 0.2 · N_p | Too long → slow solve; too short → constrained, sub-optimal |
| State weight | Q | Bryson-rule: Q_ii = 1 / (x_i,max)² | Wrong relative tracking aggression |
| Input weight | R | Bryson-rule: R_ii = 1 / (u_i,max)² | Chattering or sluggish actuation |
| Rate weight | S | 0.1 × R typical for smoothing | Mechanical fatigue or audible chatter |
| Terminal weight | P | Solve DARE for unconstrained loop’s P | Tail instability with short N_p |
| Soft-constraint penalty | ρ | 10²–10⁶ × largest Q | Too small → constraint ignored; too large → numerical ill-cond |
Sample time. Chemical loops 1 s – 60 s. Robotic / motor 0.5 ms – 10 ms. Aerospace inner loops 100 µs – 2 ms. Building HVAC 30 s – 5 min.
Bryson’s scaling rule. Set Q_ii = 1 / (max acceptable x_i deviation)² and R_ii = 1 / (max acceptable u_i)². This normalizes the cost to dimensionless quadratic deviations and is the right starting point before manual tuning.
Soft constraints are mandatory. Hard state-constraint MPC will return infeasible the first time a disturbance pushes the plant past y_max — the controller faults, the plant runs open-loop, the operator panics. Always replace hard output constraints with soft ones:
y_min - ε ≤ y_i ≤ y_max + ε, ε ≥ 0, add ρ · εᵀε to cost
Hard constraints stay only on actuator limits (where they’re physically inviolable).
Disturbance modeling for offset-free tracking. A nominal LMPC has no integral action — it will hold a constant offset under a step disturbance. The standard fix (Maeder/Borrelli/Morari 2009): augment the state with a disturbance state d, estimated by a Kalman filter against the output residual. Including d in the prediction model recovers offset-free tracking and is the closest thing to “integral action” in MPC. Every production MPC ships with this.
Reference preview. If you know future setpoints (e.g. a robot trajectory or HVAC schedule), feed them directly into the cost — MPC will pre-act to track the upcoming change rather than lagging behind. This is one of MPC’s distinctive advantages over PID and is free once you’ve already written the QP.
Commissioning sequence. A robust commissioning recipe used by both vendors and good in-house teams:
- Step-test the open-loop plant. Inject step inputs in each manipulated variable, record outputs for 5–10 settling times. Identify a state-space or transfer-function model (subspace ID, ARX/ARMAX least-squares, or first-principles).
- Validate the model offline. Predict response on held-out data; mean absolute error should be ≤ 10–20 % of the dominant output range.
- Tune offline with Bryson scaling. Q, R, S as 1/(max)². Simulate a step response and a worst-case disturbance.
- Soften every output constraint. Set ρ = 10⁴ as a starting point.
- Configure the observer. Kalman filter with disturbance augmentation; tune covariance ratio to give the closed loop the integral action it needs.
- Walk the plant up. Start in advisory mode (controller computes, operator types in the moves). Move to automatic on a single manipulated variable, then bring others online one by one over days to weeks.
- Audit every active constraint. A constraint that is always saturated is mis-specified or marks an under-sized actuator; a constraint that is never active is overhead.
7p. Worked examples
Example A — Cruise control with rate limits
Plant: longitudinal velocity v (m/s), throttle u ∈ [−0.5, 0.5] normalized (negative = brake). Continuous-time model:
v̇ = −0.05 v + 0.5 u + 0.05 v_grade
Discretize at T_s = 0.1 s (zero-order hold): A = exp(−0.005) ≈ 0.9950, B = 0.5 · (1 − A) / 0.05 ≈ 0.04988.
MPC formulation: N_p = 20, N_c = 10, Q = 1.0 (on speed error), R = 0.1, S = 5.0 on Δu (rate). Constraints: u ∈ [−0.5, 0.5], |Δu| ≤ 0.01 per sample (= 0.1 / s).
Step from rest to 30 m/s reference. Hand-solved trajectory:
| t (s) | v (m/s) | u | Δu |
|---|---|---|---|
| 0.0 | 0.00 | 0.500 | — |
| 0.5 | 4.91 | 0.500 | 0 |
| 1.0 | 9.34 | 0.500 | 0 |
| 2.0 | 16.4 | 0.500 | 0 |
| 4.0 | 24.9 | 0.480 | −0.01 |
| 6.0 | 28.7 | 0.310 | −0.01 |
| 8.0 | 29.8 | 0.155 | −0.01 |
| ∞ | 30.0 | 0.150 | 0 |
The MPC saturates u = 0.5 for the first ~4 s, then anticipates the approach to setpoint and ramps u down at the −0.01 rate limit, settling exactly at 30 m/s with no overshoot. A PI controller with the same gains overshoots ~3 m/s because it cannot pre-act. The rate limit |Δu| ≤ 0.01 enforces smooth throttle motion — passenger-comfort grade — that anti-windup PI cannot guarantee.
QP size at each sample: 10 input decision variables + 20 rate-constraint slacks + 40 box-constraint multipliers. With OSQP cold-start: ~150 µs on an STM32F4 @ 168 MHz. Warm-started: ~30 µs. Both fit the 100 ms control loop with five orders of magnitude of headroom — for this scale of problem, MPC is essentially free on any modern automotive ECU.
A grade preview (downhill 3 % grade 200 m ahead, known from GPS + map) added as the disturbance term v_grade shows the preview advantage clearly: MPC lifts throttle before the slope begins, holds speed within ±0.2 m/s of setpoint over the descent. The PI controller spends 8 s above setpoint absorbing the disturbance with brake action — slower, less efficient, and uncomfortable for passengers.
Example B — 3-DOF robotic arm joint with position + torque limits
Plant per joint: τ = J θ̈ + b θ̇, where J = 0.02 kg·m², b = 0.01 N·m·s/rad. State [θ, θ̇], input τ.
Constraints: θ ∈ [−π, π], θ̇ ∈ [−3, 3] rad/s, τ ∈ [−50, 50] N·m, |τ̇| ≤ 200 N·m/s.
MPC: T_s = 1 ms, N_p = 50 (= 50 ms horizon), N_c = 10. Q = diag(100, 1) on (θ, θ̇), R = 0.001 on τ. Terminal P from DARE.
Solver: qpOASES warm-started, target hardware STM32H7 @ 480 MHz. Per-sample QP size: 10 input variables + 50 × 2 state variables (eliminated by substitution) + ~60 inequality constraints. Measured solve time: 200–400 µs (median 280 µs), comfortably inside the 1 ms loop.
Performance: a fast point-to-point move from θ = 0 to θ = +π/2 plans the deceleration before reaching the position limit — the trajectory smoothly hits the joint stop with θ̇ ≈ 0. A PID controller with output saturation overshoots θ = π/2 by ≈ 5° and rebounds; MPC’s plan is overshoot-free by construction. The fast inner-loop torque limit |τ| ≤ 50 N·m is respected exactly because the QP would never propose a solution outside the input box.
Example C — Distillation column, slow industrial MPC
The canonical Wood-Berry binary distillation column (Wood & Berry 1973): two manipulated variables (reflux flow R, steam flow S), two controlled variables (distillate composition x_D, bottoms composition x_B), four feedforward disturbances (feed flow F, feed composition z_F, condenser temperature, reboiler steam quality). The transfer-function matrix:
12.8 e^{−s} −18.9 e^{−3s}
G(s) = -------------- --------------
16.7 s + 1 21.0 s + 1
6.6 e^{−7s} −19.4 e^{−3s}
-------------- --------------
10.9 s + 1 14.4 s + 1
MPC settings: T_s = 60 s (one-minute control interval — column time constant ~17 min), N_p = 60 (1 h horizon), N_c = 10. Composition setpoints x_D = 96 mol % MeOH, x_B = 0.5 mol % MeOH.
Cost: economic MPC. Stage cost = energy_price · S + quality_penalty · (x_B − x_B,spec)² · 1{x_B > x_B,spec}. Hard constraints on reboiler duty (S ≤ S_max = avoid flooding) and condenser duty. Soft band on x_D ∈ [95.5, 96.5] mol % with ρ = 10⁴.
Solver: Aspen DMC3, ~5000-variable QP, solved in ~2 s out of 60 s sample interval — comfortable margin. Online identification refreshes step-response models nightly to track fouling drift.
Published benefit vs the legacy distributed-PID layer (Honeywell case study, ExxonMobil refinery 2014): 25–30 % reduction in steam consumption at constant product spec, attributed mostly to running closer to the flooding constraint than the conservative PID overrides allowed. Payback period under 18 months on column retrofits.
Example D — Wind-turbine pitch control with rate-limited actuators
Above-rated wind operation. Plant: rotor speed Ω (rad/s), tower fore-aft displacement x_t (m), pitch angle β (deg). Linearized around 18 m/s wind: 4-state, 1-input (pitch reference), 1-disturbance (wind speed). MPC: T_s = 50 ms, N_p = 40 (= 2 s), N_c = 8. Q heavy on Ω deviation from rated (1.71 rad/s ≡ 16.3 RPM for a 5-MW turbine), light on tower position; R modest on β; S heavy on β̇ to honor the hydraulic pitch-rate limit of ±8 °/s.
Soft constraints on Ω ∈ [1.55, 1.85] rad/s (over-speed trip at 1.95). Hard constraint on β̇. Lidar-based wind preview (when fitted) gives 5–10 s lookahead and is fed directly as the disturbance forecast — MPC starts pitching out before a gust arrives, reducing peak Ω by 30 % and peak tower load by 15 % vs nominal MPC without preview (Schlipf et al. 2013). Major contributor to fatigue-life extension on offshore turbines.
Example E — Quadrotor trajectory tracking (NMPC)
Plant: 12-state quadrotor (position, attitude, linear and angular velocities), 4 inputs (rotor thrusts). Continuous-time rigid-body dynamics; aerodynamic drag captured by a quadratic term in body-frame velocity. NMPC formulation: T_s = 10 ms, N_p = 20 (= 200 ms horizon), N_c = 20 (no blocking). Cost: position tracking on the reference trajectory + attitude regulation + thrust effort.
Constraints: rotor thrust ∈ [0, T_max] per motor, body angular rate |ω_body| ≤ 6 rad/s (mechanical limit on the IMU), tilt angle |φ|, |θ| ≤ 60° (to keep the linearization-based onboard estimator valid).
Solver: acados with RTI scheme, code-gen for the Pixhawk PX4 Cube Black (STM32H753 @ 480 MHz). Per-sample solve time: ~600 µs (median), worst-case ~1.4 ms over 1000-sample test runs — comfortably inside 10 ms. Memory footprint: 180 kB Flash, 24 kB RAM.
Performance: tracks a 3-D figure-8 trajectory at 3 m/s peak speed with RMS position error 4.5 cm — about 3× better than the PX4 stock cascaded P-PID controller on the same airframe, with the largest gain in agile-maneuver segments where PID’s static gains are mistuned for the worst-case operating point. The cost of running NMPC vs PID: ~6 % of total CPU on the H7 (300 µs every 10 ms loop) — well worth it for the tracking improvement.
8p. Edge cases & gotchas
Model mismatch. MPC’s predictions are only as good as the model. A 20 % gain error in the input channel typically degrades closed-loop performance gracefully; a sign error or a missed deadtime can destabilize. Mitigation: nightly model-quality reports (mean prediction error vs measured response), adaptive MPC with recursive least-squares model update, or simply tune ζ-equivalent damping conservatively.
Infeasibility under disturbance. Hard state constraints + a step disturbance that violates them = QP returns “infeasible” = controller faults. The standard remedies, in increasing complexity: (a) softening all output constraints, (b) reference governor that scales the setpoint back into feasibility, (c) tube-MPC with constraint tightening, (d) explicit fallback to a back-up PID. Every production MPC carries (a) and a fallback.
Worst-case computational cost. Active-set methods are fast when the active set is stable between samples (warm start) but can blow up to the cold-start cost when a disturbance changes which constraints are active. The relevant number is the 99th-percentile solve time, not the mean. Embedded MPC must size its sample period around p99 + headroom — typically 2× p99 — or the solver will occasionally miss a deadline.
Numerical conditioning. The Hessian H = block-diagonal of R augmented by horizon stacking can become ill-conditioned for long horizons or large state-cost / input-cost ratios. Pre-scaling (column equilibration) or Ruiz scaling inside the solver is essential. Symptom of bad conditioning: solve time spikes, solutions degrade randomly.
State estimation is not optional. MPC is a state-feedback controller. If x is not fully measured (almost never is) you need an observer — a Kalman filter is the textbook answer. The augmented Kalman filter for the disturbance state is the same filter that gives you offset-free tracking. Estimation error couples directly into prediction error; budget for it.
Unmodeled actuator dynamics. A real valve, motor, or hydraulic actuator has finite bandwidth that MPC’s prediction usually assumes is infinite. Either include actuator dynamics in the model (state augmentation) or accept that the input “u” you compute is not what the plant immediately sees, and tune accordingly.
Saturation interaction with the integrator state. If you augment the state with a disturbance integrator and that integrator winds up against a saturated input, behaviour mimics classical integrator wind-up. The disturbance estimator should be configured with anti-windup logic (e.g. don’t update d when an input constraint is active).
Anti-pattern: “use MPC for everything.” PID controls roughly 90–95 % of installed industrial loops globally and is the right answer for the vast majority. Reach for MPC only when the constraint-handling, MIMO coupling, preview, or economic objective arguments above genuinely apply. A poorly-tuned MPC is harder to fix than a poorly-tuned PID, and the supporting operator culture is much thinner.
Operator culture and trust. PID has 60 years of operator vocabulary (“bump the setpoint”, “drop the gain”). MPC speaks of horizons, weights, soft penalties, observer poles — alien dialect to most field staff. A production MPC needs a clear operator interface, transparent constraint-violation reporting, and a tested fallback-to-manual path. The technology is only as good as the humans who maintain it.
Hidden costs. A production MPC requires ongoing model maintenance — equipment ages, fouls, gets retrofitted, and the model drifts. Industry rule of thumb: 10–20 % of the original engineering hours per year for model refresh, constraint review, and operator retraining. Skip that and the controller silently degrades until performance regresses below the legacy PID baseline. The Qin & Badgwell 2003 survey reports that ~30 % of installed industrial MPCs have been disabled or downgraded at some point in their life, almost always for lack of maintenance rather than fundamental design failure.
Mixing time scales. MPC sample rates that are too fast relative to the embedded compute budget force solver early-termination, which silently produces sub-optimal moves. Symptoms: increasing tracking error during transient maneuvers, occasional constraint violations, no obvious fault. Diagnostic: log per-sample solver-iteration counts and solver exit status; if exits with “max-iterations” appear more than ~1 % of the time, the sample rate is too aggressive or the solver too slow.
Loss of QP convexity. Successive-linearization NMPC builds a QP each sample from the current operating-point Jacobians. If the linearization happens at a point where the Hessian becomes indefinite (poorly conditioned cost or model), the resulting QP is non-convex and the active-set solver wanders. Mitigation: regularize the Hessian with a small Tikhonov diagonal addition, or switch to interior-point which handles ill-conditioning more gracefully.
Stale measurement / dropped sample. A sensor that times out, an EtherCAT cycle that drops, or a CAN bus storm can leave the controller with no fresh state. Two failure modes: (a) it stalls waiting and misses its deadline, (b) it computes a move from a stale x̂_k that no longer matches reality. The robust embedded pattern is a sample-skipping policy with explicit hand-off to the safe fallback after N consecutive misses.
Don’t underestimate scaling. Refinery-scale MPC has ~10²–10³ inputs/outputs and ~10⁴–10⁵ decision variables once horizons are stacked. The QP is sparse and structured but not small. Memory layout, parallelism, and warm-start quality all matter at this scale; a 2× speed-up from solver tuning is often worth more than another iteration of model identification.
Reverse-engineering legacy MPC. When inheriting an undocumented industrial MPC, the practical diagnostic ladder is: read every constraint band actually in use; look at which constraints are active in operator logs; trace which MVs (manipulated variables) move and which sit pinned; talk to the operator who runs the unit every shift. The “tuning” is usually 90 % constraints and 10 % weight matrix, and the constraints reveal more about plant economics than the controller datasheet ever does.
Cybersecurity and integrity. An MPC controller computing optimal moves from real-time measurements is an attractive attack surface. Spoofed sensor data, manipulated model parameters, or denial-of-service against the solver can all cause unsafe action. The IEC 62443 standards for industrial cybersecurity apply directly. Best practices: cryptographic signing of model files, watchdog on solver health, plausibility checks on measurement inputs, and a guaranteed safe-fallback control mode.
9p. Tools & software
MPC design / prototyping
| Tool | Origin | Licence | Best for |
|---|---|---|---|
| MATLAB MPC Toolbox | MathWorks | Commercial | Industry default; linear, gain-scheduled, adaptive, explicit; code-gen via Embedded Coder |
| CasADi | KU Leuven (Andersson/Diehl) | LGPL | The open-source NMPC stack; symbolic AD + ODE/DAE + NLP |
| acados | KU Leuven / Freiburg | BSD | Fastest embedded NMPC code-gen in C; RTI scheme |
| do-mpc | TU Dortmund (Lucia/Engell) | LGPL | Python wrapper around CasADi for rapid prototyping |
| YALMIP | Lofberg / Linköping | MIT-like | MATLAB modelling layer with MPC examples; great for explicit-MPC research |
| MPCTools | UC Santa Barbara (Rawlings) | GPL | Octave/MATLAB; companion to the Rawlings/Mayne/Diehl textbook |
| HILO-MPC | TU Berlin | LGPL | ML-augmented MPC (Gaussian processes, neural ODEs) |
| MPT3 (Multi-Parametric Toolbox) | ETH Zürich (Herceg/Kvasnica/Jones/Morari) | GPL | Explicit MPC synthesis, polyhedral computation, reach-set analysis |
| Simulink Control Design + Predictive Control | MathWorks | Commercial | Closed-loop tuning + sensitivity analysis layered over MPC Toolbox |
QP / NLP solvers
| Solver | Type | Notable property |
|---|---|---|
| OSQP | ADMM (interior-point) | BSD-licensed, embeddable, code-gen to C; sub-ms on Cortex-M |
| qpOASES | Active-set | Best-in-class warm-start; widely used in NMPC SQP loops |
| HPIPM | Structured interior-point | Frison/Diehl; fastest for banded MPC QPs |
| DAQP | Active-set | Newer (Arnström 2022); deterministic worst-case bound |
| FORCES Pro | Code-gen interior-point + active-set | Embotech commercial; certified for automotive |
| CVXGEN | Interior-point code-gen | Stanford (Boyd group); small QPs only |
| ECOS | Interior-point SOCP | Stellato; for stochastic / SOCP-form MPC |
| IPOPT | Interior-point NLP | Wächter/Biegler; standard NMPC NLP back-end via CasADi |
| Gurobi / CPLEX / MOSEK / Xpress | Commercial MILP/MIQP | Hybrid MPC at desktop scale |
Industrial MPC platforms
| Product | Vendor | Typical install |
|---|---|---|
| DMCplus / DMC3 | AspenTech | Refining, petrochem; thousands of seats |
| Profit Controller / Profit Optimizer | Honeywell | Refining, gas plants |
| SMOC / SMOC-Pro | Shell (via Yokogawa / Aspen) | Originating refinery MPC product line |
| PredictPro / DeltaV Predict | Emerson | DCS-integrated MPC for chemicals |
| Apex Predict / Apex Optimize | AVEVA (formerly Wonderware) | General process industries |
| PACE | Schneider Electric | Process MPC |
| MV-PRO | ABB | Pulp & paper, mining |
| CPC (Connoisseur) | Invensys / Schneider | Legacy installs in oil & gas |
Automotive / embedded MPC
| Platform | Use case |
|---|---|
| dSPACE TargetLink + MPC blocks | Production-grade automotive code-gen |
| ETAS ASCET + Bosch toolchain | OEM internal MPC for ESP, torque vectoring |
| MathWorks Embedded Coder + MPC Toolbox | Cross-industry; OEM ECUs and rapid prototypes |
| NI VeriStand + LabVIEW MPC | HIL testing, hardware-in-the-loop |
| Speedgoat / Concurrent xPC | Real-time research targets, automotive bench |
| acados + STM32 / TI C2000 / Infineon AURIX | Open-source embedded NMPC on automotive-grade MCUs |
11. Cross-references
[[Engineering/circuit-analysis]],[[Engineering/ac-analysis-three-phase]]— the linear-system foundation MPC builds on.[[Engineering/op-amps]]— analog feedback as the historic predecessor to digital model-based control.[[Engineering/power-electronics]]— switching converters where finite-control-set MPC has become a 2010s research-to-product success story.[[Engineering/electric-motors]]— MPC for field-oriented control and torque/flux references.[[Engineering/microcontrollers]]— the embedded compute envelope (Cortex-M, C2000, AURIX) constraining solver choice.[[Engineering/pcb-design]]— analog front-ends and ADC scaling that feed the state estimator.[[Engineering/vibration-dynamics]]— modal models that MPC may need to suppress (resonant modes in robotic and aerospace structures).[[Engineering/digital-logic]]— the FPGA implementation pathway for high-rate finite-control-set MPC.- planned
[[Engineering/classical-control]]— PID, root locus, frequency response — the baseline MPC is judged against. - planned
[[Engineering/state-space-methods]]— companion note: MPC unconstrained = LQR, observer = Kalman. - planned
[[Engineering/digital-control]]— discretization, aliasing, sample-time selection. - planned
[[Engineering/realtime-embedded]]— worst-case execution time, deadline scheduling, the operational floor of embedded MPC. - planned
[[Robotics/state-space-lqr]]— joint-level MPC for industrial robot arms. - planned
[[Robotics/path-planning]]— trajectory generation that feeds MPC’s reference preview. - planned
[[Robotics/Tier3/perception-sensors]]— path-tracking NMPC at 50–100 Hz. - planned
[[Languages/Tier3/scientific]]— the lingua franca of control-systems engineering and MPC Toolbox. [[Languages/Tier3/scientific]]— CasADi, AMPL, JuMP, Pyomo for formulating the optimization problems MPC reduces to at each sample.
12. Citations
Canonical textbooks
- Rawlings, J. B., Mayne, D. Q. & Diehl, M. M. (2017). Model Predictive Control: Theory, Computation, and Design (2nd ed.). Nob Hill Publishing. Free PDF at https://sites.engineering.ucsb.edu/~jbraw/mpc/. The reference text.
- Maciejowski, J. M. (2002). Predictive Control with Constraints. Prentice Hall. The bridge text from classical control to MPC.
- Camacho, E. F. & Bordons, C. (2007). Model Predictive Control (2nd ed.). Springer. Spanish-school treatment, strong on industrial DMC heritage.
- Borrelli, F., Bemporad, A. & Morari, M. (2017). Predictive Control for Linear and Hybrid Systems. Cambridge University Press. The canonical hybrid-MPC and explicit-MPC reference.
- Kouvaritakis, B. & Cannon, M. (2016). Model Predictive Control: Classical, Robust and Stochastic. Springer. Best single source for robust and stochastic MPC.
- Grüne, L. & Pannek, J. (2017). Nonlinear Model Predictive Control: Theory and Algorithms (2nd ed.). Springer.
Foundational papers
- Cutler, C. R. & Ramaker, B. L. (1980). “Dynamic Matrix Control — A Computer Control Algorithm.” Joint Automatic Control Conference, San Francisco. The DMC paper that started industrial MPC.
- Richalet, J., Rault, A., Testud, J. L. & Papon, J. (1978). “Model Predictive Heuristic Control: Applications to Industrial Processes.” Automatica 14(5), 413–428. The IDCOM paper, parallel-developed with DMC.
- García, C. E., Prett, D. M. & Morari, M. (1989). “Model Predictive Control: Theory and Practice — A Survey.” Automatica 25(3), 335–348. The survey that codified MPC’s place in the field.
- Mayne, D. Q., Rawlings, J. B., Rao, C. V. & Scokaert, P. O. M. (2000). “Constrained Model Predictive Control: Stability and Optimality.” Automatica 36(6), 789–814. The canonical stability-conditions paper.
- Bemporad, A., Morari, M., Dua, V. & Pistikopoulos, E. N. (2002). “The Explicit Linear Quadratic Regulator for Constrained Systems.” Automatica 38(1), 3–20. The explicit-MPC foundational paper.
- Mayne, D. Q., Seron, M. M. & Raković, S. V. (2005). “Robust Model Predictive Control of Constrained Linear Systems with Bounded Disturbances.” Automatica 41(2), 219–224. Tube-MPC origin.
- Maeder, U., Borrelli, F. & Morari, M. (2009). “Linear Offset-Free Model Predictive Control.” Automatica 45(10), 2214–2222. The disturbance-augmentation / offset-free standard reference.
- Diehl, M., Bock, H. G. & Schlöder, J. P. (2005). “A Real-Time Iteration Scheme for Nonlinear Optimization in Optimal Feedback Control.” SIAM Journal on Control and Optimization 43(5), 1714–1736. The RTI paper that enabled embedded NMPC.
- Qin, S. J. & Badgwell, T. A. (2003). “A Survey of Industrial Model Predictive Control Technology.” Control Engineering Practice 11(7), 733–764. The standard reference for industrial MPC installation counts and vendor landscape.
Solver papers
- Stellato, B., Banjac, G., Goulart, P., Bemporad, A. & Boyd, S. (2020). “OSQP: An Operator Splitting Solver for Quadratic Programs.” Mathematical Programming Computation 12(4), 637–672.
- Ferreau, H. J., Kirches, C., Potschka, A., Bock, H. G. & Diehl, M. (2014). “qpOASES: A Parametric Active-Set Algorithm for Quadratic Programming.” Mathematical Programming Computation 6(4), 327–363.
- Frison, G. & Diehl, M. (2020). “HPIPM: A High-Performance Quadratic Programming Framework for Model Predictive Control.” IFAC-PapersOnLine 53(2), 6563–6569.
- Andersson, J. A. E., Gillis, J., Horn, G., Rawlings, J. B. & Diehl, M. (2019). “CasADi — A Software Framework for Nonlinear Optimization and Optimal Control.” Mathematical Programming Computation 11(1), 1–36.
- Verschueren, R., Frison, G., Kouzoupis, D., Frey, J., van Duijkeren, N., Zanelli, A., Novoselnik, B., Albin, T., Quirynen, R. & Diehl, M. (2022). “acados — A Modular Open-Source Framework for Fast Embedded Optimal Control.” Mathematical Programming Computation 14, 147–183.
- Wächter, A. & Biegler, L. T. (2006). “On the Implementation of an Interior-Point Filter Line-Search Algorithm for Large-Scale Nonlinear Programming.” Mathematical Programming 106(1), 25–57. The IPOPT paper.
Variant and application papers
- Cortés, P., Kazmierkowski, M. P., Kennel, R. M., Quevedo, D. E. & Rodríguez, J. (2008). “Predictive Control in Power Electronics and Drives.” IEEE Transactions on Industrial Electronics 55(12), 4312–4324. The reference paper for FCS-MPC in power electronics.
- Schlipf, D., Schlipf, D. J. & Kühn, M. (2013). “Nonlinear Model Predictive Control of Wind Turbines Using LIDAR.” Wind Energy 16(7), 1107–1129. Preview-based wind-turbine MPC.
- Camponogara, E., Jia, D., Krogh, B. H. & Talukdar, S. (2002). “Distributed Model Predictive Control.” IEEE Control Systems Magazine 22(1), 44–52. The DMPC origin paper.
- Scattolini, R. (2009). “Architectures for Distributed and Hierarchical Model Predictive Control — A Review.” Journal of Process Control 19(5), 723–731.
- Hewing, L., Kabzan, J. & Zeilinger, M. N. (2019). “Cautious Model Predictive Control Using Gaussian Process Regression.” IEEE Transactions on Control Systems Technology 28(6), 2736–2743. Safe learning-based MPC.
- Lucia, S., Tătulea-Codrean, A., Schoppmeyer, C. & Engell, S. (2017). “Rapid Development of Modular and Sustainable Nonlinear Model Predictive Control Solutions.” Control Engineering Practice 60, 51–62. The do-mpc paper.
Industrial case material
- Wood, R. K. & Berry, M. W. (1973). “Terminal Composition Control of a Binary Distillation Column.” Chemical Engineering Science 28(9), 1707–1717. Source of the Wood-Berry column model used throughout MPC pedagogy.
- Bauer, M. & Craig, I. K. (2008). “Economic Assessment of Advanced Process Control — A Survey and Framework.” Journal of Process Control 18(1), 2–18. Quantitative benefit data for industrial MPC.
- Ellis, M., Durand, H. & Christofides, P. D. (2014). “A Tutorial Review of Economic Model Predictive Control Methods.” Journal of Process Control 24(8), 1156–1178.
- Forbes, M. G., Patwardhan, R. S., Hamadah, H. & Gopaluni, R. B. (2015). “Model Predictive Control in Industry: Challenges and Opportunities.” IFAC-PapersOnLine 48(8), 531–538. Practitioner perspective on the realities of industrial MPC deployment, including maintenance and culture issues.
- Darby, M. L. & Nikolaou, M. (2012). “MPC: Current Practice and Challenges.” Control Engineering Practice 20(4), 328–342. An honest accounting of where industrial MPC genuinely outperforms PID and where it does not.
Standards and regulatory
- IEC 62443 (continuously revised). Industrial Communication Networks — IT Security for Networks and Systems. Applies directly to MPC controllers connected to plant networks.
- ISA-95 (continuously revised). Enterprise-Control System Integration. The hierarchy in which MPC sits between Level 2 (regulatory control) and Level 3 (manufacturing operations).
- ANSI/ISA-88. Batch Control. Relevant when MPC is layered into recipe-driven batch processes (specialty chemicals, biotech, pharmaceuticals).