Model Predictive Control Toolbox provides functions, Simulink blocks, and MPC Designer app for designing and simulating
model predictive controllers.
In this video you will see how to use MPC Designer app to design 2x2 MPC controller for the diesel engine plant model shown in green.
We start by opening MPC Controller block dialog and pressing “Design�? button.
This launches MPC Designer app.
We start our work in the app by defining MPC structure.
The app parses the Simulink model and figures out that there are 2 manipulated variables and 2 measured outputs.
We specify the sampling time here, and we also specify the operating point around which to linearize the model.
Here we will trim the model by specifying the values of manipulated variables that we want to linearize at.
These values have been stored in the variable U0.
When we trim the model, we see the new operating point has been computed.
The actual values of manipulated variables at the operating point match the desired values,
and all state derivatives are small, indicating that the system is in steady state.
We can now define our controller and linearize the model.
When we do that, the app designs the initial MPC controller and shows the plots for the default simulation scenario.
In this scenario we command step changes of size 1 at 1 second for both measured outputs.
The measured outputs are shown on the right and the manipulated variables- on the left.
We can now click on “IO attributes�? to adjust the scale factors.
Scale factors help us tune the controller better by taking into account the engineering unit values for our input and output signals.
We can next move to the Tuning tab where we can adjust controller properties such as sampling time, and prediction and control
horizons.
MPC controllers are very good at dealing with input/output constraints.
We can specify the constraints by clicking on the Constraints button.
In this case we want to limit the rate of change for our manipulated variables.
When we press “Apply�?, the controller is updated. We can next use the sliders to tune the performance of our controller,
to make it more aggressive or more robust.
We can store a design that we like, and compare it with other designs.
At any time during the design we can add a new simulation scenario or modify the existing one.
For example, we can change the step size for our second measured output to -2,
and command that step to happen at 5 seconds.
Once we have a design that we like, we can review it for any potential problems.
The report that opens up shows the various checks that the app performed.
Any areas that need further attention are highlighted in yellow or red.
We can now take the controller we designed and use it in the MPC Controller block in our Simulink model.
When we update the block, we see that the controller object is now used by the block.
We can now run our nonlinear Simulink model, and check the performance of the MPC Controller we designed.
Finally, we can generate C or structured text from the MPC Controller block to implement the MPC controller on a microprocessor or a PLC.
This concludes the video.