Main Content

Compute effect of controller tuning weights on performance

`[J,sens] = sensitivity(MPCobj,PerfFunc,PerfWeights,Tstop,r,v,simopt,utarget)`

[J,sens] = sensitivity(MPCobj,'perf_fun',param1,param2,...)

The `sensitivity`

function is a controller tuning aid.
`J`

specifies a scalar performance metric.
`sensitivity`

computes `J`

and its partial
derivatives with respect to the controller tuning weights. These
*sensitivities* suggest tuning weight adjustments that should
improve performance; that is, reduce `J`

.

`[J,sens] = sensitivity(MPCobj,PerfFunc,PerfWeights,Tstop,r,v,simopt,utarget)`

calculates the scalar performance metric, `J`

, and sensitivities,
`sens`

, for the controller defined by the MPC controller object
`MPCobj`

.

`PerfFunc`

must be one of the following:

`'ISE'`

(integral squared error) for which the performance metric
is

$$J={\displaystyle \sum _{i=1}^{Tstop}\left({\displaystyle \sum _{j=1}^{{n}_{y}}{({w}_{j}^{y}{e}_{yij})}^{2}+{\displaystyle \sum _{j=1}^{{n}_{u}}[{({w}_{j}^{u}{e}_{uij})}^{2}+{({w}_{j}^{\Delta u}\Delta {u}_{ij})}^{2}]}}\right)}$$

`'IAE'`

(integral absolute error) for which the performance metric
is

$$J={\displaystyle \sum _{i=1}^{Tstop}\left({\displaystyle \sum _{j=1}^{{n}_{y}}\left|{w}_{j}^{y}{e}_{yij}\right|+{\displaystyle \sum _{j=1}^{{n}_{u}}(|{w}_{j}^{u}{e}_{uij}|+|{w}_{j}^{\Delta u}\Delta {u}_{ij}|)}}\right)}$$

`'ITSE'`

(integral of time-weighted squared error) for which the
performance metric is

$$J={\displaystyle \sum _{i=1}^{Tstop}i\Delta t\left({\displaystyle \sum _{j=1}^{{n}_{y}}{({w}_{j}^{y}{e}_{yij})}^{2}+{\displaystyle \sum _{j=1}^{{n}_{u}}[{({w}_{j}^{u}{e}_{uij})}^{2}+{({w}_{j}^{\Delta u}\Delta {u}_{ij})}^{2}]}}\right)}$$

`'ITAE'`

(integral of time-weighted absolute error) for which the
performance metric is

$$J={\displaystyle \sum _{i=1}^{Tstop}i\Delta t}\left({\displaystyle \sum _{j=1}^{{n}_{y}}\left|{w}_{j}^{y}{e}_{yij}\right|+{\displaystyle \sum _{j=1}^{{n}_{u}}(|{w}_{j}^{u}{e}_{uij}|+|{w}_{j}^{\Delta u}\Delta {u}_{ij}|)}}\right)$$

In the above expressions *n _{y}* is the number of
controlled outputs and

The *w* parameters are nonnegative performance weights defined by
the structure `PerfWeights`

, which contains the following
fields:

`OutputVariables`

—*n*element row vector that contains the $${w}_{j}^{y}$$ values_{y}`ManipulatedVariables`

—*n*element row vector that contains the $${w}_{j}^{u}$$ values_{u}`ManipulatedVariablesRate`

—*n*element row vector that contains the $${w}_{j}^{\Delta u}$$ values_{u}

If `PerfWeights`

is unspecified, it defaults to the corresponding
weights in `MPCobj`

. In general, however, the performance weights and
those used in the controller have different purposes and should be defined
accordingly.

Inputs `Tstop`

, `r`

, `v`

, and
`simopt`

define the simulation scenario used to evaluate
performance. See `sim`

for details.

`Tstop`

is the integer number of controller sampling intervals to be
simulated. The final time for the simulations will be *Tstop* × Δ*t*, where Δ*t* is the controller sampling interval
specified in `MPCobj`

.

The optional input `utarget`

is a vector of
*n _{u}* manipulated variable targets. Their
defaults are the nominal values of the manipulated variables.
Δ

The structure variable `sens`

contains the computed sensitivities
(partial derivatives of `J`

with respect to the
`MPCobj`

tuning weights.) Its fields are:

`OutputVariables`

—*n*element row vector of sensitivities with respect to_{y}`MPCobj.Weights.OutputVariables`

`ManipulatedVariables`

—*n*element row vector of sensitivities with respect to_{u}`MPCobj.Weights.ManipulatedVariables`

`ManipulatedVariablesRate`

—*n*element row vector of sensitivities with respect to_{u}`MPCobj.Weights.ManipulatedVariablesRate`

For more information on the tuning weights controller property, see `mpc`

.

`[J,sens] = sensitivity(MPCobj,'perf_fun',param1,param2,...)`

employs a performance function `'perf_fun'`

to define
`J`

. Its function definition must be in the form

`function J = perf_fun(MPCobj, param1, param2, ...)`

That is, it must compute `J`

for the given controller and optional
parameters `param1`

, `param2`

, ... and it must be on
the MATLAB^{®} path.

**Note**

While performing the sensitivity analysis, the software ignores time-varying, nondiagonal, and ECR slack variable weights.