# Adaptive, Gain-Scheduled, and Nonlinear MPC | Understanding Model Predictive Control, Part 4

From the series: Understanding Model Predictive Control

*Melda Ulusoy, MathWorks*

This video explains the type of MPC controller you can use based on your plant model, constraints, and cost function. The available options include the linear time-invariant, adaptive, gain-scheduled, and nonlinear MPC.

If you have a linear plant model and your MPC problem has linear constraints and a linear cost function, then you can use linear time-invariant MPC to control your system. An optimization problem with these properties is a convex one, and you can use many types of there are numerical methods and software to solve it. If your system is nonlinear, but it can be approximated by linear models at operating points of interest, then you can use adaptive or gain-scheduled MPC. In adaptive MPC, a linear model is computed on the fly as the operating conditions change. In gain-scheduled MPC, the linearization is performed offline at the operating points of interest.

If your plant is highly nonlinear, these options probably won’t provide satisfactory performance. In that case, you can use nonlinear MPC. In addition, you can use nonlinear if you have a linear plant model but either the constraints, the cost function, or both are nonlinear.

**Linear and Nonlinear Model Predictive Controllers**

You want to control your system with an MPC controller, but you’re not sure which methods are available? Then keep watching because I’m going to give you some recipes. I’ll start with some pancake recipes. If you can bear with me, you’ll see the connection to MPC. Here’s the recipe. If you have flour, eggs and milk, you can make pancakes. Many people have tried this recipe before; it’s simple and you can’t go wrong with it. Similarly, if you have a linear system that is represented by a linear plant model, and you have linear constraints and a quadratic cost function, then you can use a linear time-invariant MPC to control your system. An MPC problem that has these nice properties gives rise to a convex optimization problem where the cost function has a single global optimum, and the goal of the optimization is to find this optimum. This is a well-studied problem, and you can use many types of numerical methods and software to solve it.

To get back to our pancakes: What if, instead of flour, you have almond flour. Can you still make pancakes? Yes you can! Similarly, if the system you’re dealing with is not linear but nonlinear, you can use linear MPC and still benefit from the nice properties of the convex optimization problem. The available methods to use in this case are the adaptive and gain-scheduled MPC controllers. The way these controllers deal with a nonlinear system is based on linearization. For example, let’s look at this nonlinear function. We can linearize it at an operating point, and this gives us a linear function that approximates the nonlinear system well near the operating point. However, outside of this region, the linear function that we’ve found won’t work well. So, we’re usually interested in finding multiple linearized models, each representing the nonlinear function well around its operating point. This is the regular MPC control diagram that we discussed previously which uses an internal plant model and an optimizer to compute the control action. In adaptive MPC, a linear model is computed on the fly as the operating conditions change. And at each time step, you update the internal plant model used by the MPC controller with this linear model. Note that in adaptive MPC, the structure of the optimization problem remains the same across different operating points. This means that the number of states, and number of constraints don’t change for different operating conditions over the prediction horizon. However, if they do change, then you should use gain-scheduled MPC. In gain-scheduled MPC, you linearize offline at the operating points of interest and for each operating point, you design a linear MPC controller. Each controller is independent from each other and therefore may have a different number of states, and different number of constraints. Note that in this approach you also need to design an algorithm that will switch between the predefined MPC controllers for different operating conditions. Although having independent controllers is an advantage of gain-scheduled MPC, it uses more memory than adaptive MPC. Therefore, the recommendation is to use adaptive MPC if a linear plant model can be found at run-time and the structure of the optimization problem remains fixed across different operating conditions. And if they change, then you can use gain-scheduled MPC, where you can design independent MPC controllers for the changing operating conditions.

Now back to pancakes. Say that you don’t have the regular ingredients you usually bake with but very unique ones that you’re not even familiar with. Making pancakes with these ingredients will be really challenging but once you figure out they will be the best tasting pancakes ever. If you have a nonlinear system that can’t be approximated well by linear models, then you can use nonlinear MPC. This method is the most powerful one as it uses the most accurate representation of the plant, namely a nonlinear plant model. Therefore, the predictions made by the controller are more accurate which also lead to better control actions. However, it is also the most challenging one to solve in real-time, because when you have nonlinear constraints and a nonlinear cost function, the optimization problem becomes nonconvex. The cost function may have multiple local optima and finding the global optimum may be hard. The efficiency of solving the nonconvex optimization problem that requires a large number of computations depends on the nonlinear solver you have.

In summary, if the plant you’re dealing with is nonlinear but can be approximated by linear models, you can use adaptive and gain-scheduled MPC controllers. Use adaptive MPC if the structure of optimization problem doesn’t change across different operating conditions. However, if it does, then you can use gain-scheduled MPC. If none of these work because you have a highly nonlinear system that can’t be approximated well by linearization, then you can use nonlinear MPC.

In the next video, we’ll talk about implementation tips for running model predictive controllers faster.

#### Related Products

#### Learn More

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

### Asia Pacific

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)