Model Predictive Control Toolbox™ Previous page   Next Page 
sim
 Provide feedback about this page

Simulate closed-loop/open-loop response to arbitrary reference and disturbance signals

Syntax

Description

The purpose of sim is to simulate the MPC controller in closed loop with a linear time-invariant model, which, by default, is the plant model contained in MPCobj.Model.Plant. As an alternative, sim can simulate the open-loop behavior of the model of the plant, or the closed-loop behavior in the presence of a model mismatch between the prediction plant model and the model of the process generating the output data.

sim(MPCobj,T,r) simulates the closed-loop system formed by the plant model specified in MPCobj.Model.Plant and by the MPC controller specified by the MPC object MPCobj, and plots the simulation results. T is the number of simulation steps. r is the reference signal array with as many columns as the number of output variables.

sim(MPCobj,T,r,v) also specifies the measured disturbance signal v, that has as many columns as the number of measured disturbances.

sim(MPCobj,T,r,SimOptions) or sim(MPCobj,T,r,v,SimOptions) specifies the simulation options object SimOptions, such as initial states, input/output noise and unmeasured disturbances, plant mismatch, etc. See mpcsimopt for details.

Without output arguments, sim automatically plots input and output trajectories.

[y,t,u,xp,xmpc,SimOptions]=sim(MPCobj,T,...) instead of plotting closed-loop trajectories returns the sequence of plant outputs y, the time sequence t (equally spaced by MPCobj.Ts), the sequence u of manipulated variables generated by the MPC controller, the sequence xp of states of the model of the plant used for simulation, the sequence xmpc of states of the MPC controller (provided by the state observer), and the options object SimOptions used for the simulation.

The descriptions of the input arguments and their default values are shown in the table below.

Input Argument
Description
Default
MPCobj
MPC object specifying the parameters of the MPC control law
None
T
Number of simulation steps
Largest row-size of r,v,d,n
r
Reference signal
MPCobj.Model.Nominal.Y
v
Measured disturbance signal
Entries from MPCobj.Model.Nominal.U
SimOptions
Object of class @mpcsimopt containing the simulation parameters (See mpcsimopt)
[]

r is an array with as many columns as outputs, v is an array with as many columns as measured disturbances. The last sample of r/v/d/n is extended constantly over the horizon, to obtain the correct size.

The output arguments of sim are detailed below.

Output Argument
Description
y
Sequence of controlled plant outputs (without noise added on measured ones)
t
Time sequence (equally spaced by MPCobj.Ts)
u
Sequence of manipulated variables generated by MPC
xp
Sequence of states of plant model (from Model or SimOptions.Model)
xmpc
Sequence of states of MPC controller (estimates of the extended state). This is a structure with the same fields as the mpcstate object.

Examples

We want to simulate the MPC control of a multi-input single-output system (the same model as in demo misosim.m). The system has one manipulated variable, one measured disturbance, one unmeasured disturbance, and one output.

See Also

mpcsimopt, mpc, mpcmove


 Provide feedback about this page 

Previous page setoutdist size Next page

 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS