Specifications
Simulate Controller with Nonlinear Plant
4-9
Simulate Controller with Nonlinear Plant
You can use sim to simulate a closed-loop system consisting of a linear plant model and
an MPC controller.
If your plant is a nonlinear Simulink model, you must linearize the plant (see
“Linearization Using Linear Analysis Tool in Simulink Control Design”) and design a
controller for the linear model (see “Design Controller in Simulink”). To simulate the
system, specify the controller in the MPC block parameter MPC Controller field and
run the closed-loop Simulink model.
Alternatively, your nonlinear model might be a MEX-file, or you might want to include
features unavailable in the MPC block, such as a custom state estimator. The mpcmove
function is the Model Predictive Control Toolbox computational engine, and you can use
it in such cases. The disadvantage is that you must duplicate the infrastructure that the
sim function and the MPC block provide automatically.
The rest of this section covers the following topics:
• “Nonlinear CSTR Application” on page 4-9
• “Example Code for Successive Linearization” on page 4-10
• “CSTR Results and Discussion” on page 4-12
Nonlinear CSTR Application
The CSTR model described in “Linearize Simulink Models” on page 2-21 is a strongly
nonlinear system. As shown in “Design Controller in Simulink”, a controller can regulate
this plant, but degrades (and might even become unstable) if the operating point changes
significantly.
The objective of this example is to redefine the predictive controller at the beginning of
each control interval so that its predictive model, though linear, represents the latest
plant conditions as accurately as possible. This will be done by linearizing the nonlinear
model repeatedly, allowing the controller to adapt as plant conditions change. See
references [1] and [2] for more details on this approach.