model predictive control toolbox

11
Model Predictive Control Toolbox Design and simulate model predictive controllers Model Predictive Control Toolbox™ provides tools for systematically analyzing, designing, and tuning model predictive controllers. You can design and simulate model predictive controllers using functions in MATLAB ® or blocks in Simulink ® . You can set and modify the predictive model, control and prediction horizons, input and output constraints, and weights. The toolbox enables you to diagnose issues that could lead to run-time failures and provides advice on changing weights and constraints to improve performance and robustness. By running different scenarios in linear and nonlinear simulations, you can evaluate controller performance. You can adjust controller performance as it runs by tuning weights and varying constraints. For rapid prototyping and embedded system design, the toolbox supports C-code generation. Key Features Design and simulation of model predictive controllers in MATLAB and Simulink Customization of constraints and weights with advisory tools for improved performance and robustness Control of plants over a range of operating conditions using multiple model predictive controllers with bumpless control transfer Run-time adjustment of controller performance through constraint and weight changes Specialized model predictive control quadratic programming (QP) solver optimized for speed, efficiency, and robustness Support for C-code generation with Simulink Coder™ 1

Upload: odilon-abreu

Post on 27-Nov-2015

20 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Model Predictive Control Toolbox

Model Predictive Control ToolboxDesign and simulate model predictive controllers

Model Predictive Control Toolbox™ provides tools for systematically analyzing, designing, and tuning modelpredictive controllers. You can design and simulate model predictive controllers using functions in MATLAB® orblocks in Simulink®. You can set and modify the predictive model, control and prediction horizons, input andoutput constraints, and weights. The toolbox enables you to diagnose issues that could lead to run-time failuresand provides advice on changing weights and constraints to improve performance and robustness. By runningdifferent scenarios in linear and nonlinear simulations, you can evaluate controller performance. You can adjustcontroller performance as it runs by tuning weights and varying constraints. For rapid prototyping and embeddedsystem design, the toolbox supports C-code generation.

Key Features▪ Design and simulation of model predictive controllers in MATLAB and Simulink

▪ Customization of constraints and weights with advisory tools for improved performance and robustness

▪ Control of plants over a range of operating conditions using multiple model predictive controllers withbumpless control transfer

▪ Run-time adjustment of controller performance through constraint and weight changes

▪ Specialized model predictive control quadratic programming (QP) solver optimized for speed, efficiency, androbustness

▪ Support for C-code generation with Simulink Coder™

1

Page 2: Model Predictive Control Toolbox

Getting Started with Model Predictive Control Toolbox 10:07Use Model Predictive Control Toolbox™ to design and simulate model predictivecontrollers.

MPC Controller block (red) for designing and simulating model predictive controllers directly in Simulink.

Designing and Simulating Model Predictive Controllers

Model predictive controllers can be used to optimize closed-loop system performance of MIMO plants subject toinput and output constraints. Because they base their actions on an internal plant model, model predictivecontrollers can forecast future process behavior and adjust control actions accordingly. The ability to modelprocess interactions often enables model predictive controllers to outperform multiple PID control loops, whichrequire individual tuning and other techniques to reduce loop coupling.

Model Predictive Control Toolbox provides functions, Simulink blocks, and a graphical tool for designing andsimulating model predictive controllers in MATLAB and Simulink.

You can iteratively improve your controller design by defining an internal plant model, adjusting controllerparameters such as weights and constraints, and simulating closed-loop system response to evaluate controllerperformance.

2

Page 3: Model Predictive Control Toolbox

Defining Internal Plant Models

When designing a model predictive controller in Simulink, you can use Simulink Control Design™ to extract alinearized form of the Simulink model and automatically import it into the controller as the internal plant model.

Alternatively, you can use linear time-invariant (LTI) systems from Control System Toolbox™, such as a transferfunction or a state-space model, to specify the internal plant model. You can import LTI models from theMATLAB workspace or from MAT-files into the toolbox. The toolbox also lets you directly import modelscreated from measured input-output data using System Identification Toolbox™.

Designing Controllers

Once you have defined the internal plant model you can complete the design of your model predictive controllerby specifying the following controller parameters:

▪ Prediction and control horizons

▪ Hard and soft constraints on manipulated variables and output variables

▪ Weights on manipulated variables and output variables

▪ Models for measurement noise and for unmeasured input and output disturbances

Dialog box for selecting a plant model and specifying the control interval, prediction horizon, and control horizon in ModelPredictive Control Toolbox.

3

Page 4: Model Predictive Control Toolbox

Dialog box for setting constraints on manipulated variables and output variables in Model Predictive Control Toolbox.

In addition to constant constraints and weights, the toolbox supports time-varying constraints and weights,constraints on linear combinations of manipulated variables and output variables, terminal constraints andweights, and constraints in the form of linear off-diagonal weights. The toolbox also supports constraint softening.

Running Closed-Loop Simulations

You can use MATLAB functions or a graphical tool to run closed-loop simulations of your model predictivecontroller against linear plant models. The graphical tool lets you set up multiple simulation scenarios. For eachscenario you can specify controller set points and disturbances by choosing from common signal profiles, such asstep, ramp, sine wave, or random signal.

4

Page 5: Model Predictive Control Toolbox

Graphical tool for configuring and running a simulation to test a controller against a linear plant model.

To assess the effects of model mismatch, you can simulate a controller against a linear plant model that is differentfrom the internal plant model used by the controller. You can also simulate multiple controller designs against thesame plant model to see how different weight and constraint settings affect controller performance. The toolboxlets you disable constraints to evaluate characteristics of the closed-loop dynamics, such as stability and damping.

Using Simulink blocks provided with Model Predictive Control Toolbox, you can run closed-loop simulations ofyour model predictive controller against a nonlinear Simulink model. You can configure the blocks to accepttime-varying constraint signals that are generated by other Simulink blocks.

5

Page 6: Model Predictive Control Toolbox

Simulink model for running closed-loop simulations of a model predictive controller and a nonlinear plant model, withcontroller constraints calculated by other Simulink blocks.

Customizing Constraints and Weights

Model Predictive Control Toolbox provides several tools to help you optimize controller performance bycustomizing controller constraints and weights.

Adjusting Weights with the Tuning Advisor

The toolbox provides the Tuning Advisor, which guides you in setting weights to improve controller performance.You can use the Tuning Advisor to:

▪ Select a cost function that measures the difference between a reference signal and measured plant output, andcompute the cost function value for the baseline design

▪ Compute sensitivities of the cost function to individual weights

▪ Determine whether individual weights should be increased or decreased to improve controller performance

▪ Adjust the weights and recompute the cost function value

By repeating this interactive process, you can systematically adjust controller weights to optimize controllerperformance.

6

Page 7: Model Predictive Control Toolbox

Weight Tuning for Model Predictive Controllers 7:24Use Tuning Adviser to adjust model predictive controller weights to improve controllerperformance.

Analyzing Constraints and Weights for Potential Run-Time Failures

The product provides a diagnostic function to detect potential stability and robustness issues with your modelpredictive controller, such as:

▪ The model predictive controller or the closed-loop system is unstable.

▪ The quadratic programming (QP) optimization problem is ill-defined with an invalid Hessian matrix.

▪ Zero steady-state offset cannot be achieved.

▪ Hard and soft constraint settings may lead to infeasible optimization problems at run-time.

You can use this diagnostic tool to adjust controller weights and constraints during controller design to avoidrun-time failures.

Results of diagnostic tests for potential model predictive controller run-time failures.

Controlling Plants Over a Range of Operating Conditions

You can use the Multiple MPC Controllers block for controlling a nonlinear Simulink plant model over a widerange of operating conditions. With this block you can design a model predictive controller for each operatingpoint and switch between model predictive controllers at run time. The Multiple MPC Controllers block ensuresbumpless control transfer from one model predictive controller to another. You can create linear plant models forcontroller design at each operating point either by linearizing a Simulink model with Simulink Control Design orby specifying the plant model directly.

7

Page 8: Model Predictive Control Toolbox

Multiple MPC Controllers block (red) for controlling nonlinear models over a wide operating range using multiple modelpredictive controllers with bumpless control transfer. With this block you can design a model predictive controller for eachoperating point and switch between model predictive controllers at run time.

Adjusting Run-Time Controller Performance

Model Predictive Control Toolbox supports monitoring run-time controller performance and adjusting run-timetuning parameters.

Monitoring Run-Time Controller Performance

Model predictive controllers formulate and solve a QP optimization problem at each computation step. The QPsolver supplied with the toolbox is optimized for performance and robustness. It achieves convergence even whenthe optimization problem is ill-conditioned.

For rare occasions when the optimization may fail to converge due to process abnormalities, the MPC Controllerblock lets you monitor optimization status at run time. You can access the optimization status signal to detectwhen an optimization fails to converge, and decide if a backup control strategy should be used.

The MPC Controller block also lets you access the optimal cost and optimal control sequence at each computationstep. You can use these signals to analyze controller performance and to develop custom control strategies. Forexample, you may use optimal cost information for switching between two model predictive controllers whoseoutputs are restricted to discrete values.

8

Page 9: Model Predictive Control Toolbox

Simulink model that uses the optimal cost signal to switch between two model predictive controllers whose outputs are restrictedto discrete values. You can compare the reference signal (top right, red) and plant output (top right, blue) to evaluate controllerperformance, and you can plot the manipulated variable (controller output) to see when the control strategy switches betweencontrollers.

Adjusting Run-Time Tuning Parameters

The toolbox lets you adjust the run-time tuning parameters of your model predictive controller to optimize itsperformance at run time without redesigning or reimplementing it. To perform run-time controller tuning inSimulink, you configure the MPC Controller block to accept the appropriate run-time tuning parameters. You canalso perform run-time controller tuning in MATLAB.

Model Predictive Control Toolbox provides access to the following run-time tuning parameters:

▪ Weights on plant outputs

▪ Weights on manipulated variables

▪ Weight on overall constraint softening

9

Page 10: Model Predictive Control Toolbox

Simulink model for run-time tuning of model predictive controller parameters. Model Predictive Control Toolbox enablesrun-time tuning by changing weights on plant outputs, weights on manipulated variables, and the weight on overall constraintsoftening.

Deploying Model Predictive Controllers

The toolbox provides two ways to deploy a controller in an application. You can use Simulink Coder to generateC code from Simulink blocks provided with Model Predictive Control Toolbox and deploy the code to asupported target system for implementation or rapid prototyping.

10

Page 11: Model Predictive Control Toolbox

System Identification and Control Using OPC Data 17:58Improve process performance by designing and implementing a model predictive controller.Use OPC Toolbox™ and System Identification Toolbox™ to collect the input-output dataand create a plant model.

Product Details, Examples, and System Requirementswww.mathworks.com/products/mpc

Trial Softwarewww.mathworks.com/trialrequest

Saleswww.mathworks.com/contactsales

Technical Supportwww.mathworks.com/support

Hardware setup for rapid prototyping of a model predictive controller on PC-compatible hardware using Simulink Coder andxPC Target™.

You can also use OPC Toolbox™ to connect a controller operating in MATLAB directly to an OPC-compliantsystem.

Resources

Online User Communitywww.mathworks.com/matlabcentral

Training Serviceswww.mathworks.com/training

Third-Party Products and Serviceswww.mathworks.com/connections

Worldwide Contactswww.mathworks.com/contact

© 2012 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list ofadditional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. 11