13. Model Predictive and Constraint-Aware ControlIntroduction and ContextClassical feedback control is usually designed around a fixed operating point and a relatively small number of manipulated variables. Such controllers can be highly effective, but many modern engineering systems operate under conditions that make a purely local control strategy inadequate. Actuators have finite ranges and rates, safety limits must not be violated, variables are coupled, and economic objectives may conflict with regulation objectives. A process may also contain delays, multivariable interactions, and changing operating conditions. Model Predictive Control (MPC) addresses these difficulties by repeatedly using a dynamic model to predict future plant behaviour, solving an optimization problem over a finite prediction horizon, implementing only the first control action, and repeating the procedure when new measurements become available. This procedure is called receding-horizon control. Constraints are not treated as afterthoughts; they are included directly in the optimization problem. MPC is therefore both a control methodology and a decision-making framework. It combines modelling, prediction, optimization, feedback, and constraint management. Its applications range from petrochemical columns and power converters to energy storage, building climate systems, autonomous vehicles, and microgrids. Learning ObjectivesAfter studying this chapter, the reader should be able to: 1. Explain the operating principle and architecture of linear and nonlinear MPC. 2. Formulate prediction models and finite-horizon optimization problems. 3. Distinguish hard, soft, state, input, rate, and terminal constraints. 4. Explain recursive feasibility, stability, and the role of terminal ingredients. 5. Compare quadratic-programming, nonlinear-programming, and fast embedded solvers. 6. Interpret economic MPC and its difference from conventional tracking MPC. 7. Select suitable models, horizons, constraints, and implementation strategies. 8. Assess practical risks and apply MPC to energy and process-system problems. From Feedback Control to Receding-Horizon OptimizationConsider a discrete-time linear system x(k+1) = Ax(k) + Bu(k), y(k) = Cx(k), where x is the state vector, u is the manipulated-input vector, and y is the measured-output vector. In conventional state-feedback control, a control law such as u(k) = -Kx(k) is computed in advance. MPC instead calculates a sequence of future inputs, often denoted by u(k|k), u(k+1|k), ..., u(k+N-1|k), where N is the control horizon. The notation k+i|k means a prediction made at time k for time k+i. The optimizer predicts the future states and outputs, evaluates a cost function, and selects the best admissible sequence. Only u(k|k) is applied. At the next sampling instant, the current state or an estimate of it is updated, the optimization is solved again, and the next first action is implemented. This feedback correction makes MPC more robust than an open-loop finite-horizon plan. The central design principle is anticipation. If an output is approaching an upper limit, the controller can reduce the input before the limit is reached. If a future demand increase is known or forecast, energy storage can be charged in advance. The controller can also coordinate several actuators while respecting their individual limitations. Linear MPC FormulationFor a reference-tracking application, a common finite-horizon cost is J = Σ(i=0 to N-1) [(y(k+i|k)-r(k+i))ᵀQ(y(k+i|k)-r(k+i)) + Δu(k+i|k)ᵀRΔu(k+i|k)] + (y(k+N|k)-r(k+N))ᵀP(y(k+N|k)-r(k+N)), where Q weights tracking errors, R penalizes input movement, P is a terminal weight, and Δu(k) = u(k)-u(k-1). The input-movement term discourages aggressive or oscillatory actuation. A larger Q emphasizes regulation, whereas a larger R produces smoother control action and may reduce actuator wear. The optimization is subject to the model equations and constraints such as u_min ≤ u(k+i|k) ≤ u_max, Δu_min ≤ Δu(k+i|k) ≤ Δu_max, y_min ≤ y(k+i|k) ≤ y_max. State constraints may also be imposed when the state has physical or safety significance. For example, a battery state of charge may be restricted to a safe interval, and a reactor temperature may have a maximum allowable value. When the model is linear and the cost is quadratic, the problem is generally a Quadratic Program (QP). In condensed form, the predicted outputs can be written as Y = F x(k) + G U, where U is the stacked future-input vector. Substitution into the quadratic cost gives a quadratic objective in U, while linear constraints remain linear. This structure permits reliable and fast numerical solution. State Estimation and Disturbance ModellingMPC requires an estimate of the current state. In many systems not all states are measured, so an observer, Kalman filter, moving-horizon estimator, or augmented-state estimator is used. A mismatch between the measured output and the model prediction can be corrected through a disturbance estimate. Common approaches include output-error correction, integrating disturbance models, and bias estimation. Disturbance models are particularly important for offset-free tracking. If a constant load disturbance is not represented, the optimizer may find a model-based input that appears correct but produces a persistent real-world error. An integrating disturbance model or integral action can remove this offset, provided that the resulting augmented system remains observable and numerically well conditioned. Constraints: The Defining Feature of Practical MPCA constraint describes a permissible region of operation. Input constraints arise from actuator saturation, valve capacity, inverter current, pump limits, or available heating power. Rate constraints represent the maximum speed of valve movement, motor acceleration, or power ramping. Output and state constraints express product quality, pressure, temperature, voltage, current, or safety requirements. Hard constraints must be satisfied by every feasible solution. They are appropriate for physical or regulatory limits, but an infeasible optimization problem can cause the controller to fail. Soft constraints allow controlled violation by introducing nonnegative slack variables, for example, y(k+i|k) ≤ y_max + ε_i, ε_i ≥ 0. A penalty such as ρΣ ε_i² or ρΣ ε_i is added to the objective. The penalty must be sufficiently large that violation is used only when necessary, but not so large that it causes poor numerical conditioning. Safety-critical constraints should not automatically be softened; independent protection systems may be required. Constraint prioritization is often implemented through different slack penalties. A product-quality limit may be softened slightly, while an emergency temperature limit remains hard. This expresses engineering priorities explicitly rather than leaving them implicit in arbitrary tuning weights. Feasibility, Stability, and RobustnessA feasible MPC problem has at least one input sequence satisfying the model and all constraints. Feasibility may be lost because of an unexpected disturbance, an inaccurate state estimate, a model mismatch, or an overly restrictive constraint set. Feasibility at one sampling time does not automatically guarantee feasibility forever unless suitable assumptions and terminal conditions are satisfied. Recursive feasibility means that if the optimization is feasible at the current time, the controller can construct a feasible solution at the next time. A common argument shifts the previous optimal sequence one step forward and appends a stabilizing terminal control law. This is one reason terminal sets and terminal controllers are used in theoretical MPC. A terminal cost based on a local Lyapunov function and a terminal invariant set can establish closed-loop stability for constrained linear systems. In industrial practice, simpler formulations may omit an explicit terminal set and rely on long horizons, suitable weights, or a steady-state target calculation. Such approaches can work well, but their stability and feasibility properties should be assessed rather than assumed. Robust MPC accounts for uncertainty explicitly. Tube MPC maintains the nominal trajectory inside a tightened constraint set while a local feedback controller rejects bounded disturbances. Min-max MPC optimizes against worst-case uncertainty but may be computationally demanding. Chance-constrained MPC treats constraints probabilistically, for example requiring that a temperature limit be violated with probability below a specified threshold. The choice depends on uncertainty knowledge, risk tolerance, computation, and available measurements. Nonlinear and Hybrid MPCMany systems cannot be represented adequately by a linear model over the operating range of interest. A nonlinear model may be written as x(k+1) = f(x(k),u(k),d(k)), y(k) = h(x(k)), where f and h are nonlinear functions and d denotes disturbances. Nonlinear MPC (NMPC) minimizes a cost subject to these nonlinear equations and constraints. The resulting problem is usually a Nonlinear Program (NLP), often solved by sequential quadratic programming, interior-point methods, or real-time iteration schemes. NMPC is useful for chemical reaction systems, autonomous vehicles, robotic manipulators, aircraft, and energy systems with nonlinear efficiencies. Its advantages include a more faithful prediction model and the ability to manage nonlinear constraints. Its disadvantages include greater computational cost, dependence on initialization, possible local minima, and sensitivity to model quality. A practical alternative is successive linearization. The model is linearized around the current predicted trajectory and a sequence of QPs is solved. This method is faster than general NMPC but may fail when nonlinearities are strong or when the operating point changes rapidly. Gain scheduling and explicit MPC are other alternatives. Explicit MPC precomputes a piecewise-affine control law for a class of linear constrained systems, allowing extremely fast online evaluation, although memory requirements can grow substantially with system dimension and horizon. Hybrid systems contain continuous dynamics and discrete events, such as equipment switching, minimum up/down times, or operating-mode changes. Their optimization may require mixed-integer quadratic or nonlinear programming. Such formulations can represent operational decisions accurately, but computational complexity must be carefully managed. Hierarchical control, in which a slower scheduling layer determines modes and a faster MPC layer regulates continuous variables, is often more practical. Economic MPCTracking MPC normally minimizes deviation from a reference. Economic MPC instead optimizes an economic cost directly, such as electricity expenditure, fuel use, production value, emissions, or equipment degradation. A general objective is J = Σ(i=0 to N-1) ℓ_e(x(k+i|k),u(k+i|k),d(k+i)) + V_f(x(k+N|k)), where ℓ_e is an economic stage cost. The economically optimal steady state need not be the nominal set point used by a tracking controller. For example, a process may operate at a higher production rate when energy is inexpensive and reduce production during a price peak, provided safety and quality constraints remain satisfied. Economic MPC must distinguish transient performance from long-term operation. A short horizon may produce attractive immediate savings but poor future decisions. Terminal costs, periodic operation, dissipativity conditions, and artificial steady-state targets are used to support stability and economically meaningful behaviour. Forecast quality is also important in applications involving electricity prices, renewable generation, or demand. Real-Time Optimization and Solver SelectionThe usefulness of MPC depends on whether its optimization can be solved reliably before the next sample arrives. Solver selection is determined by problem structure, prediction horizon, number of variables, nonlinearities, integer decisions, accuracy requirements, and hardware. Linear MPC commonly uses active-set, interior-point, or operator-splitting QP solvers. Sparse formulations exploit the banded structure produced by dynamic equations. Warm starting uses the previous solution as the initial guess and often reduces computation. Embedded implementations may use fixed-point arithmetic, code generation, tailored linear algebra, or first-order methods. NMPC solvers commonly use sequential quadratic programming or interior-point algorithms. Real-time iteration performs one or a small number of optimization iterations per sample, relying on the previous solution and slowly varying trajectories. This can provide excellent performance when the plant changes smoothly, but monitoring of residuals and constraint violations remains essential. A professional implementation should record computation time, solver status, primal and dual residuals, active constraints, slack values, and fallback actions. A controller that occasionally exceeds its deadline without a defined fallback is not a complete control design. Possible fallback strategies include holding the previous input, applying a local stabilizing controller, shortening the horizon, or solving a reduced problem. Industrial Design WorkflowA successful MPC project begins with a clearly defined control and economic objective. Engineers then identify manipulated variables, controlled variables, measurable disturbances, constraints, operating modes, and available measurements. The model may be obtained from first principles, system identification, or a hybrid of both. The model should be validated using data not used for identification. Validation must examine gains, delays, time constants, nonlinear behaviour, disturbance response, and performance near constraints. An unnecessarily detailed model can be less useful than a simpler model that is accurate over the operational region and can be solved within the sampling period. The next stage is steady-state target calculation. If the requested reference is infeasible, the target calculator determines the closest admissible operating point or the economically best feasible point. The dynamic MPC then moves the plant toward that target while respecting transient limits. Tuning should proceed from safe conservative settings. Prediction horizons must cover the important process dynamics and delays; control horizons can be shorter when later actions have limited influence. Weights should reflect engineering priorities, not merely numerical convenience. Constraint margins should account for noise, uncertainty, and actuator variability. Commissioning commonly proceeds in simulation, offline replay, shadow mode, advisory mode, and closed-loop operation. Operators need understandable displays showing predicted trajectories, active constraints, economic trade-offs, and reasons for control actions. MPC is not a replacement for basic regulatory control. It normally operates above fast inner loops, which continue to provide local stabilization and protection. Applications in Energy and Process SystemsIn electrical energy systems, MPC can coordinate batteries, photovoltaic generation, controllable loads, and grid exchange. Constraints may include state-of-charge limits, inverter current, ramp rates, feeder power, and reserve requirements. Economic MPC can use forecasts of electricity price and renewable production to schedule charging and discharging while maintaining future flexibility. In building energy management, MPC predicts thermal dynamics using weather forecasts, occupancy estimates, and building models. It can pre-cool or pre-heat a building before a high-price period while respecting comfort bounds. The main challenges are uncertain occupancy, model drift, and the need to balance energy savings with occupant acceptability. In process industries, MPC is used for distillation, reactors, boilers, furnaces, compressors, and wastewater treatment. Strong variable interactions and long delays make multivariable prediction valuable. Constraints often define the economically useful operating envelope: increasing throughput may be beneficial until a quality, pressure, temperature, or equipment limit becomes active. Illustrative Case Study: Battery-Assisted Microgrid ControlBackgroundConsider an illustrative industrial microgrid containing photovoltaic generation, a battery energy-storage system, a variable production load, and a grid connection. A supervisory MPC runs every five minutes. A faster battery controller regulates converter current, while protective relays and the battery-management system enforce independent safety limits. Situation and ProblemSolar generation is variable, production demand changes during the day, and electricity prices differ by time period. A simple rule-based controller charges whenever solar power is available and discharges whenever demand is high. This produces unnecessary cycling and may leave the battery nearly empty before an evening price peak. It may also violate an inverter ramp limit when cloud cover changes rapidly. AnalysisThe supervisory model includes battery state of charge, predicted solar power, load forecast, and grid power. The MPC objective combines electricity cost, a penalty on battery power changes, a battery-throughput penalty representing degradation, and a penalty on deviation from a desired reserve level. Constraints impose state-of-charge bounds, charging and discharging power limits, grid import limits, and ramp limits. Forecast uncertainty is represented by conservative reserve requirements. If the forecast is unreliable, the controller does not use the entire nominal battery capacity for arbitrage. Slack variables may be assigned to a noncritical grid-import preference, but not to battery safety limits. Approach and SolutionAt each five-minute interval, the controller predicts the next several hours, solves a QP using the linearized battery model, and applies only the first power command. The battery-management system can override the command if cell-level protection limits are approached. If the optimizer becomes infeasible because of a sudden load change, a feasible fallback prioritizes safe state of charge and limits the grid command. OutcomeRelative to the rule-based policy, the MPC policy is expected to coordinate charging with both future solar availability and price forecasts. It preserves reserve energy, reduces unnecessary rapid power changes, and makes constraint activity visible to operators. The result is not simply lower energy cost; it is a more predictable and safer operating policy. Learning PointsThe case illustrates four general principles: forecasts are valuable only when integrated with constraints; economic objectives must include degradation and reserve considerations; supervisory MPC should coexist with fast protection layers; and feasibility management is as important as nominal optimization. Limitations, Risks, and Common MistakesMPC cannot compensate indefinitely for a poor model. Structural errors, unmeasured disturbances, neglected delays, and changing equipment characteristics can produce systematically wrong predictions. Regular monitoring, model maintenance, and re-identification are therefore essential. A second risk is poor constraint specification. Missing a real actuator limit can produce infeasible commands, while excessively tight limits can make the controller inactive. Constraints should be traceable to engineering, safety, quality, or regulatory requirements. Weight tuning can also be misleading. A large numerical penalty does not automatically represent a correct safety priority, and poorly scaled variables can make a solver behave badly. Variables should be normalized where appropriate, and sensitivity tests should examine changes in weights, forecasts, and model parameters. Other common mistakes include using a horizon shorter than the dominant delay, ignoring input-rate limits, relying on noisy state estimates, allowing soft safety constraints without independent protection, and measuring success only by tracking error. Economic, operational, computational, and safety performance should all be evaluated. Governance, Safety, and Professional ResponsibilityMPC decisions can affect personnel safety, product quality, environmental emissions, and grid reliability. Control-room authority, alarm management, access control, change approval, and audit trails should be defined. Cybersecurity is increasingly relevant because a manipulated forecast, model, or set of constraints can alter the controller's behaviour without an obvious hardware fault. Safety instrumented systems and emergency shutdown systems should remain independent where required by risk assessment and applicable standards. MPC may optimize within a safe operating envelope, but it should not be treated as the sole barrier against hazardous conditions. Engineers must document assumptions, validation data, fallback behaviour, and the circumstances under which automatic control is disabled. Current DevelopmentsResearch and industrial practice are moving toward distributed and cooperative MPC for interconnected energy and process assets, learning-based models, uncertainty-aware forecasting, and cloud-supported supervisory optimization. Data-driven and machine-learning models can improve prediction, but they introduce concerns about extrapolation, interpretability, drift, and verification. Digital twins are being used for commissioning, operator training, and what-if analysis. Reinforcement learning is also being investigated for constrained control, although safety filters, backup controllers, and formal validation are necessary before deployment in critical systems. The strongest practical direction is not the replacement of model-based control by artificial intelligence, but the integration of reliable physical models, data-driven adaptation, optimization, and safety supervision. Best-Practice ChecklistA robust MPC design should: - define objectives and constraint priorities explicitly;
- validate the prediction model over the intended operating range;
- include state estimation and disturbance rejection;
- select horizons based on process dynamics and computational limits;
- distinguish hard safety limits from soft economic or preference constraints;
- test feasibility under disturbances and forecast errors;
- exploit solver warm starts and sparse problem structure;
- provide a documented fallback controller;
- monitor solver health, constraint activity, and model mismatch;
- retain independent regulatory and protective layers.
Chapter SummaryModel Predictive Control repeatedly solves a finite-horizon optimization problem using a dynamic prediction model and applies the first computed control action. Its distinctive strength is the direct treatment of input, rate, state, output, and operating constraints. Linear MPC generally produces quadratic programs, while nonlinear MPC handles nonlinear prediction models at greater computational cost. Feasibility and stability require careful use of terminal conditions, soft constraints, target calculation, and robust design. Economic MPC replaces or augments reference tracking with objectives such as energy cost, production value, emissions, and degradation. Practical deployment depends on state estimation, model validation, horizon selection, solver performance, fallback logic, and integration with lower-level control and safety systems. Applications in microgrids, batteries, buildings, and process plants demonstrate that MPC is a structured means of coordinating competing objectives under physical limitations. Key TermsModel Predictive Control: Feedback control based on repeated finite-horizon optimization using a dynamic model. Receding Horizon: Strategy in which only the first action of an optimized future sequence is implemented. Prediction Horizon: Number of future sampling intervals over which plant behaviour is predicted. Control Horizon: Number of future control moves independently optimized. Quadratic Program: Optimization problem with a quadratic objective and linear constraints. Nonlinear MPC: MPC using nonlinear system dynamics, output equations, or constraints. Hard Constraint: Constraint that must be satisfied by the optimization solution. Soft Constraint: Constraint whose violation is permitted through a penalized slack variable. Slack Variable: Auxiliary variable measuring the amount of constraint violation. Recursive Feasibility: Property that feasibility at one step ensures a feasible continuation at subsequent steps. Terminal Cost: Cost assigned to the predicted terminal state or output. Terminal Set: Admissible terminal region used to support feasibility and stability. Offset-Free Tracking: Elimination of steady-state tracking error despite persistent disturbances or model bias. Economic MPC: MPC that directly optimizes an economic or operational objective. Robust MPC: MPC designed to maintain acceptable operation despite bounded uncertainty or disturbances. State Estimator: Algorithm that reconstructs unmeasured states from measurements and a model. Warm Start: Use of a previous optimization solution to initialize the next solution. Hybrid MPC: MPC for systems involving both continuous dynamics and discrete decisions. Recursive Feasibility: Continuation of admissible operation under the closed-loop optimization scheme. Review QuestionsShort Answer Questions1. Why does MPC implement only the first control move of an optimized sequence? 2. Distinguish an input constraint from an input-rate constraint. 3. What is the purpose of a slack variable in soft-constrained MPC? 4. Why is state estimation required in many MPC implementations? 5. How does economic MPC differ from reference-tracking MPC? Long Answer Questions1. Derive the structure of a linear quadratic MPC problem and explain how it becomes a quadratic program. 2. Discuss recursive feasibility and the roles of terminal costs and terminal sets. 3. Compare linear MPC, successive-linearization MPC, and nonlinear MPC in terms of accuracy and computation. 4. Explain the complete workflow for commissioning an industrial MPC system. 5. Discuss how uncertainty, model mismatch, and forecast errors can be handled in constrained MPC. Analytical / Application Questions1. Design an MPC formulation for a battery in a microgrid, specifying states, inputs, objective terms, forecasts, and safety constraints. 2. A process has a long delay and a strict temperature upper bound. Explain how you would select the prediction horizon, formulate the constraint, and manage infeasibility. 3. An economic MPC controller reduces energy cost but causes excessive actuator movement. Analyze the cost function and propose technically justified modifications. 22. Multiple Choice Questions with AnswersQuestion 1What is the defining feedback feature of receding-horizon MPC? A. The complete optimized input sequence is applied without modification B. Only the first optimized input is applied, after which optimization is repeated C. The controller uses no dynamic model D. The controller ignores future constraints Correct Answer: B. Only the first optimized input is applied, after which optimization is repeated Question 2For a linear model with a quadratic objective and linear constraints, the MPC optimization problem is generally a: A. Quadratic program B. Boolean satisfiability problem C. Unconstrained nonlinear program D. Kalman filtering problem Correct Answer: A. Quadratic program Question 3Why are input-rate constraints important in an industrial MPC controller? A. They eliminate the need for state estimation B. They represent limits on how rapidly an actuator can change C. They guarantee perfect model accuracy D. They convert every nonlinear model into a linear model Correct Answer: B. They represent limits on how rapidly an actuator can change Question 4A soft output constraint is typically implemented by: A. Removing the output from the model B. Adding a slack variable and penalizing its violation C. Increasing the sampling period indefinitely D. Replacing feedback with open-loop control Correct Answer: B. Adding a slack variable and penalizing its violation Question 5Which feature most directly supports offset-free tracking under constant unmeasured disturbances? A. A disturbance or bias-estimation model B. A shorter control horizon only C. Removal of the terminal cost D. An actuator saturation limit Correct Answer: A. A disturbance or bias-estimation model Question 6What is the principal purpose of a terminal set in constrained MPC? A. To represent sensor noise exactly B. To support recursive feasibility and stability C. To eliminate all input constraints D. To increase model nonlinearity Correct Answer: B. To support recursive feasibility and stability Question 7Economic MPC differs from conventional tracking MPC because it: A. Optimizes only the prediction error B. Directly includes objectives such as energy cost, production value, or emissions C. Cannot include constraints D. Requires no forecasts Correct Answer: B. Directly includes objectives such as energy cost, production value, or emissions Question 8Which implementation technique often reduces computation by using the previous solution to initialize the next optimization? A. Warm starting B. Random restarting C. Sensor saturation D. Open-loop scheduling Correct Answer: A. Warm starting Question 9In the illustrative microgrid case, why should battery safety limits remain hard or independently protected? A. They are merely economic preferences B. Violating them can damage equipment or create unsafe operation C. They reduce the number of measured variables to zero D. They guarantee lower electricity prices Correct Answer: B. Violating them can damage equipment or create unsafe operation Question 10A controller repeatedly becomes infeasible after unexpected load changes. Which response is most appropriate? A. Ignore solver status and continue applying arbitrary commands B. Remove all physical constraints permanently C. Investigate uncertainty and provide a documented feasible fallback strategy D. Disable state estimation Correct Answer: C. Investigate uncertainty and provide a documented feasible fallback strategy
|