Overview of Model Predictive Control, MPC
Model Predictive Control (MPC) is a control theory technique that uses a model of the controlled object to predict future states and outputs, and an online optimization method to calculate optimal control inputs. MPC is used in a variety of industrial and control applications.
Key elements and features of MPC:
1. Plant model: MPC models the dynamics of the system or plant being controlled. The model is used to predict system state transitions and outputs, and the model is typically represented by difference equations, state-space models, transfer functions, etc.
2. Prediction Horizon: MPC defines a prediction horizon for predicting states and outputs at a future time. The prediction horizon is adjusted according to the response performance and computational cost of the control target.
3. Constraints: MPC can set constraints on control inputs, states, and outputs. This allows the constraints to be enforced as necessary to maintain system stability and performance.
4. optimal control problem solving: MPC solves an online optimization problem to compute the optimal control inputs within a predictive horizon. The optimization problem is to find the control input that minimizes a performance criterion (cost function) under a set of constraints, typically using a nonlinear program or linear-quadratic programming (LQ problem).
5. feedback control: MPC executes only the first control input of the prediction horizon and makes a new prediction in the next step. This allows the control inputs to be adjusted in a timely manner through feedback control, allowing the system to respond to fluctuations.
6. online computation: MPC operates online, solving optimization problems within the system’s model and prediction horizon in real time. This makes it an adaptive and suitable control method for fluctuating environments.
MPC can compute optimal control inputs under constraints, even when the control target is nonlinear and time-varying, making it a useful method for achieving goals such as response performance, tracking, stability, and energy efficiency. MPC is used in chemical process control, robotic control, power control, vehicle control, aircraft control, and many other application areas.
Algorithms used in Model Predictive Control (MPC)
There are various algorithms for MPC. The following is a description of common MPC algorithms.
1. Dynamic Programming (DP)-based MPC:
One of the basic ideas of MPC will be based on Dynamic Programming (DP). This approach finds the optimal path that minimizes the cost function for all combinations of control inputs in the forecast horizon. This is usually implemented using a DP algorithm such as value iteration or policy iteration. For more information on dynamic programming, see also “Overview of Dynamic Programming with examples and python implementation“.
2. Linear Quadratic Control (LQC):
LQC-MPC is applied when the system model is linear and the cost function is quadratic in form. LQC-MPC is applicable when the system model is linear and the cost function is quadratic. For more information on LQC, see “Overview of Linear Quadratic Control (LQC), Algorithms, and Examples of Implementations.
3. Predictive Control with Constraints:
The MPC with Constraints algorithm can incorporate constraints on control inputs, states, and outputs. This allows the optimal control inputs to be computed while adhering to the constraints, and the predictive constraint method is typically solved as a nonlinear program. For more information on Predictive Control with Constraints, please refer to “Predictive Control with Constraints: Overview, Algorithm, and Example Implementation.
4. Online Optimization:
MPC uses online optimization to compute the optimal control inputs within the predictive horizon. This optimization is typically performed using constrained nonlinear programs or quadratic programming, and in particular, optimization algorithms such as interior point and active set methods are used. For more information on online optimization, see “Overview of Online Learning and Various Algorithms, Application Examples, and Specific Implementations.
5 Real-Time Constraint Modification:
Real-time constraint modification is also used when optimization within a prediction horizon is computationally expensive. This method fixes a portion of the forecast horizon and performs optimization on the remaining portion. For more information on Real-Time Constraint Modification, please refer to “Overview of Real-Time Constraint Modification, Algorithm and Implementation Example.
6. Sample-Based MPC:
Sample-Based MPC is a method for sampling future states using a probabilistic model and performing optimization using sample statistics. Sample-Based MPC uses stochastic system models and Monte Carlo Tree Search (MCTS) described in “Overview of Monte Carlo Tree Search and Examples of Algorithms and Implementations“. For details on sample-based MPC, see “Overview of Sample-Based MPC (Sample-Based MPC), Algorithm, and Example Implementation.
MPC algorithms are selected based on the nature of the control target, constraints, and computational resources, and the selected algorithm must be appropriately tuned to stabilize the control target and optimize performance. It is a promising method for providing optimal control.
Implementation Examples of Model Predictive Control (MPC)
An example implementation of model predictive control (MPC) is described; the implementation of MPC depends on the specific application and plant, and depends on the programming language and control library used. The following is a simple MPC implementation example using Python and the SciPy library.
In this example, a one-dimensional control system is considered and includes the following elements
- System model
- Prediction horizon
- Constraints
- Cost function
import numpy as np
from scipy.optimize import minimize
# system model
A = 0.9 # Coefficients of system dynamics
B = 1.0 # Coefficient of control input
# MPC Parameters
N = 10 # Predicted Horizon Length
Q = 1.0 # State Cost Weights
R = 0.1 # Control input cost weights
umin = -1.0 # Constraint: Lower limit of control input
umax = 1.0 # Constraint: Upper limit of control input
# state update function
def update_state(x, u):
return A * x + B * u
# MPC cost function
def cost_function(u, x):
cost = 0.0
for i in range(N):
x = update_state(x, u[i])
cost += Q * x**2 + R * u[i]**2
return cost
# constraint function
def constraint(u):
return u - umin, umax - u
# Solving MPC optimization problems
x0 = 0.0 # initial state
u0 = np.zeros(N) # Initial control input
bounds = [(umin, umax)] * N
# Perform optimization
result = minimize(cost_function, u0, args=(x0,), method='SLSQP', bounds=bounds, constraints={'type': 'ineq', 'fun': constraint})
# Optimal control input
u_optimal = result.x[0]
# Apply control inputs to the system
x0 = update_state(x0, u_optimal)
In this example, MPC was implemented for a one-dimensional system to compute optimal control inputs. Actual applications may include more complex models and constraints, and although SciPy was used as the solver for the optimization problem, it may be implemented in various forms depending on the application, including commercial MPC libraries and libraries for control systems. It is common to adjust the model, constraints, prediction horizon, cost function, etc. to fit the actual problem.
Challenges in Model Predictive Control (MPC)
Model Predictive Control (MPC) is a control technique with many advantages, but there are also some challenges and limitations. The main challenges of MPC are described below.
1. computational load:
Since MPC solves optimization problems online, the computational load can be high. Computation time may increase, especially when the prediction horizon is long or the model to be controlled is very complex.
2. sample time selection:
MPC performance depends on the sample time. If the sample time is too long, the MPC may not be able to cope with sudden changes in the system, and if the sample time is too short, the computational load may increase. Selection of an appropriate sample time is important.
3. handling of constraint conditions:
Proper handling of constraint conditions is an issue. Especially when nonlinear constraints are considered, optimization problems can become complex and numerical stability issues may arise.
4. model errors:
Since system models usually cannot perfectly represent the actual control target, model errors exist. Real-time model readjustment or compensation is required to mitigate the effects of model errors.
5. constraint mitigation:
When it is difficult to strictly adhere to constraints, it is necessary to temporarily relax the constraints to maintain stability. However, relaxing constraints may cause performance degradation.
6. sampling noise:
Sampling noise and external perturbations to the system can affect MPC performance. To address this, a combination of robust control techniques is needed.
7. model uncertainty:
Model predictive control depends on the model being controlled. High model uncertainty and variability can affect control performance.
To address these challenges, techniques such as proper tuning of MPC parameters, real-time model updating, combining robust control methods, model refinement, and sample time optimization are used. In some application areas, MPC may be combined with other control methods to balance stability and performance.
Addressing the Challenges of Model Predictive Control (MPC)
There are several approaches and remedies for addressing the challenges of Model Predictive Control (MPC). They are described below.
1. reduction of computational load:
To reduce the computational load, efficient optimization algorithms and high-performance computing resources should be used. It is also important to control the amount of computation by adjusting the prediction horizon and selecting sample times that can be computed in real time.
2. handling of constraints:
To properly handle constraints, nonlinear optimization algorithms and constraint relaxation (introduction of slack variables) will be used. On-line optimization of constraint relaxation and hierarchization of constraints are also being considered.
3. model error mitigation:
To deal with model errors, improve the accuracy of model predictions and automatically adjust the model. The use of real-time control (State Estimation) and non-parametric model prediction control (Nonparametric MPC) to complement model prediction is also being considered.
4. constraint relaxation:
When constraint conditions need to be relaxed, soft constraint conditions may be introduced. This allows for temporary non-compliance with the constraint conditions and maintains performance while minimizing constraint violations.
5. handling sampling noise:
To deal with sampling noise, stochastic MPC and stochastic optimization approaches are employed. This allows control to account for system uncertainty.
6. model uncertainty management:
To deal with model uncertainty, model reliability improvement and robust MPC may be used. Robust MPC helps to handle model uncertainty and maintain performance stability.
7. sample time selection:
The choice of sample time affects performance and requires experimentation and coordination to select the optimal sample time. Selecting the appropriate sampling frequency for a fast system is key.
Reference Information and Reference Books
For more information on optimization in machine learning, see also “Optimization for the First Time Reading Notes” “Sequential Optimization for Machine Learning” “Statistical Learning Theory” “Stochastic Optimization” etc.
Reference books include Optimization for Machine Learning
“Machine Learning, Optimization, and Data Science“
“Linear Algebra and Optimization for Machine Learning: A Textbook“
コメント