Model Predictive Control: Receding Horizon Algorithm, Two-Zone Thermal Regulation, and Disturbance Rejection
Fundamentals of the Model Predictive Control (MPC) Algorithm
Receding Horizon Control Overview:
Model Predictive Control (MPC) solves a constrained, finite-horizon optimal control problem at every discrete sampling instant .
Rather than applying an entire pre-calculated trajectory open-loop, MPC implements only the first calculated control action and shifts the prediction window forward at the subsequent time step, establishing closed-loop feedback.
Step-by-Step Algorithmic Procedure:
Step 1: State Measurement or Estimation:
Measure or estimate the current plant state vector , denoted as .
At the initial step of the horizon (), the measurement corresponds to the system's initial state .
In receding-horizon operations, the optimization is re-initialized at each sampling instant with the newly measured or estimated state as the starting point.
Step 2: Solve Finite-Horizon Optimal Control:
Formulate and solve a constrained finite-horizon optimal control problem spanning a prediction horizon of length .
The optimization generates an open-loop sequence of optimal control inputs based on the nominal plant dynamics model.
Step 3: Obtain Optimal Control Sequence:
Extract the computed optimal control input sequence:
Each element represents the predicted optimal control action for time step , determined at sampling instant .
Step 4: Apply the First Control Action:
Apply only the initial control input from the optimal sequence to the physical plant:
The remaining planned inputs () are discarded for execution.
Step 5: Advance Time Horizon and Repeat:
Advance the system time step from to .
Collect the new state measurement or estimate , shift the prediction horizon forward by one sampling period, and re-solve the optimization problem.
Theoretical Rationale for Full-Horizon Calculation:
Computing control inputs across the entire horizon ensures that the control action selected at step maintains stability, feasibility, and performance along the complete anticipated future trajectory.
Solving for the complete sequence prevents the system from driving towards short-term gains that lead to boundary violations or dynamic instability at later stages.
In practical control implementations where communication bottlenecks or sensor dropouts occur, the unapplied elements () serve as an open-loop fallback trajectory to maintain operation until state feedback is restored.
Mathematical Modeling of Two-Zone Thermal Systems
System Description:
The controlled plant consists of two thermally connected rooms (zones).
Each room is equipped with an independent thermal actuator capable of providing heating or cooling.
State and Control Input Vectors:
The system state vector represents the zone temperatures at discrete-time instant : where is the temperature of Room 1 and is the temperature of Room 2 in degrees Celsius ().
The control input vector represents the thermal input delivered to each room: where governs Room 1 and governs Room 2.
Discrete-Time Linear Thermal Dynamics:
The system dynamics follow a discrete-time linear state-space representation:
The state transition matrix describes thermal retention and inter-zone heat transfer:
Diagonal elements () govern the internal thermal retention within each zone per discrete time step.
Off-diagonal elements () represent the thermal coupling coefficient between Room 1 and Room 2 via their shared boundary wall.
The control input matrix describes actuator authority and cross-zone leakage:
Diagonal elements () represent direct heat input to the respective room.
Off-diagonal elements () characterize the fraction of heating or cooling that leaks into the adjacent room.
Ambient Environment Interaction and Thermal Disturbance Term ():
The ambient outside temperature is constant at .
The term captures static heat exchange between each room and the external ambient environment:
Because the ambient temperature () exceeds the zone temperatures, external heat conduction constantly introduces a positive baseline heat load of per sampling interval into both rooms.
MPC Optimization Problem Formulation
Control Objectives and Setpoints:
Initial zone temperatures at time step are given by:
The desired setpoint target (reference vector ) is: requiring Room 1 to be regulated to and Room 2 to .
Prediction Horizon and Cost Weighting Matrices:
Prediction horizon length: .
State tracking error weight matrix :
Control effort weight matrix :
Terminal state tracking error weight matrix :
Constrained Finite-Horizon Optimization Formulation:
At each sampling instant , the MPC controller solves:
The cost function consists of stage costs over steps and a terminal penalty:
Subject to system dynamic constraints over the prediction horizon:
Subject to the state initialization constraint:
Subject to symmetrical actuator saturation limits:
Structure of the Optimization Decision Vector:
The decision vector concatenates all future control inputs over the horizon:
Because the system has inputs and a horizon length of , the total number of decision variables is: yielding .
Plant-Model Mismatch and External Disturbances
Unmodeled Disturbance Injection:
To evaluate controller robustness against plant-model mismatch, an unmodeled external thermal disturbance affects Room 1 beginning at discrete time step .
Physical scenario: While both rooms are being actively cooled by air conditioning, a large door or window is opened in Room 1 at time step , causing hot outside air to rush into Room 1.
Mathematical Disturbance Profile ():
The time-dependent additive disturbance vector is defined as:
The disturbance acts directly on Room 1 ( additive heat influx per step) with zero direct input into Room 2.
Actual Plant Dynamics vs. Nominal Controller Model:
The true physical plant evolves according to:
The nominal internal prediction model utilized by both the Open-Loop Optimal Controller and the MPC internal predictor excludes the disturbance:
Because is unmodeled, neither controller possesses predictive knowledge of the disturbance onset or magnitude.
Algorithmic Implementation in MATLAB
Nonlinear Optimization Engine:
The optimization problem is solved computationally using the MATLAB nonlinear programming solver
fmincon.Decision variable structure in
fmincon:The vector is organized as a flattened column vector of dimension .
Indices through correspond to Room 1 control inputs ().
Indices through correspond to Room 2 control inputs ().
Inside the objective evaluation function, is reshaped into a matrix to evaluate the system dynamics.
Actuator limits are supplied directly to
fminconvia lower bound vectorlb( for all entries) and upper bound vectorub( for all entries).
Single-Shooting Formulation:
The state dynamics are evaluated inside a trajectory cost function (
trajectory_cost), which sequentially calls a system simulation routine (simulate_states).Because state trajectories are propagated forward from the initial state using the nominal state-space equations, state dynamic constraints are inherently satisfied without requiring explicit nonlinear equality constraints (
nonlincon).
Comparison of Open-Loop Optimal Control vs. Closed-Loop MPC Architectures:
Open-Loop Optimal Control Execution:
fminconis invoked once at using initial state .The entire resulting optimal input matrix is applied open-loop to the actual plant model containing .
No feedback measurements are gathered; the trajectory cannot adjust when activates at .
Closed-Loop MPC Execution:
At each step , the controller acquires the current plant state measurement from the true system:
fminconsolves the finite-horizon problem over horizon initialized at , using the nominal model ().The controller extracts the first inputs for Room 1 and Room 2 ( and ) and stores them in
uMPC.These inputs are injected into the real system (which includes ), updating the true state to .
The process repeats across the operational duration.
Comparative Performance Analysis and Thermal Coupling Dynamics
Final Regulation Metrics:
Reference target temperatures: Room 1 , Room 2 .
Open-Loop Optimal Control Results:
Final Room 1 temperature: (deviating by above reference, peaking near ).
Final Room 2 temperature: (deviating by above reference).
Closed-Loop MPC Results:
Final Room 1 temperature: (deviating by only from reference).
Final Room 2 temperature: (tracking within of reference, stabilizing near setpoint).
Disturbance Compensation Behavior:
Between and , both control methods drive zone temperatures downward from and toward the setpoints.
At , the onset of the disturbance injects unmodeled thermal energy into Room 1.
The open-loop optimal controller, unable to detect the resulting trajectory divergence, continues executing its precomputed input trajectory, allowing temperatures in Room 1 to climb to .
MPC detects the state divergence at through state feedback and immediately recalculates the optimal trajectory, adjusting the control effort in Room 1 to counteract the unexpected heat load.
Analysis of Room 2 Thermal Coupling:
Room 2 receives no direct disturbance ( for all ).
The control input trajectories for Room 2 in both Open-Loop Optimal Control and MPC are virtually identical throughout the entire time horizon.
Despite identical actuator effort in Room 2, open-loop control causes Room 2 to overheat (), whereas MPC achieves regulation near .
Root Cause via Thermal Cross-Coupling ():
Under open-loop control, Room 1 overheats to . Heat conducts through the inter-zone boundary into Room 2, overpowering Room 2's actuator.
Under MPC, Room 1 is regulated near . The inter-zone temperature gradient is eliminated, preventing thermal leakage from destabilizing Room 2.
Course Administration and Final Project Guidelines
Final Project Approval Process:
Each student must select an academic paper to implement for the course final project and obtain instructor approval.
Selection and approval must be finalized as early as possible rather than delaying until the final deadline.
A short project proposal must be drafted and submitted in accordance with the final project instruction document.
Final Project Presentation Timeline:
Final project presentations are scheduled for two weeks from the lecture date, on Tuesday, November 17, 2026.
Curriculum Progression:
Lecture 20 concludes the Model Predictive Control instructional block.
The subsequent lecture begins neural network fundamentals, focusing on neural network modeling and learning-based control systems.
A practice homework assignment covering both Optimal Control and MPC will be released over the upcoming weekend.
Questions and Discussion
Query Regarding Full-Horizon Input Computation:
Question: Why compute a complete sequence of future control inputs () across the entire prediction horizon if only the first control input () is ever applied to the physical system?
Answer: Computing inputs across the entire horizon ensures that the selected immediate control action accounts for future dynamics, terminal costs, and system constraints, preventing the system from running off course. Additionally, if sensor measurements, state estimations, or communication signals are temporarily lost, the remaining open-loop sequence provides a valid fallback control plan.
Query Regarding Project Paper Selection Deadlines:
Question: Was a strict Friday deadline set for selecting and submitting the final project research article?
Answer: There is no rigid Friday deadline; however, approval must be obtained as soon as possible because presentations occur on Tuesday, November 17, 2026, and project implementation cannot begin without prior approval of the short proposal.
Query Regarding Terminology:
Question: What does the abbreviation "OC" stand for?
Answer: "OC" stands for Optimal Control.
Query Regarding Zero vs. Non-Zero Initial States and Steady-State Targets:
Question: Does MPC require an initial state of zero, and how does MPC handle non-zero or varying steady-state reference targets?
Answer: MPC does not require a zero initial state; the state measurement is updated with the actual system state at each time step. Furthermore, target steady states are entirely application-specific and need not be zero (e.g., and in the thermal model). In dynamic environments like autonomous vehicle control, reference setpoints and required control inputs vary continuously (e.g., steering angle and lane-centering error adjust when entering a curved road, whereas control efforts remain steady along straight paths).