Main Content

sensitivity

Calculate the value of a performance metric and its sensitivity to diagonal weights

Description

example

[J,sens] = sensitivity(MPCobj,PerfFunc,PerfWeights,Ns,r,v,SimOptions,utarget) calculates the scalar performance metric, J, and its sensitivity to the diagonal weights sens, for the controller defined by the MPC controller object MPCobj.

Examples

collapse all

Define a third-order plant model with three manipulated variables and two controlled outputs.

plant = rss(3,2,3);
plant.D = 0;

Create an MPC controller for the plant.

MPCobj = mpc(plant,1);
-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10.
-->The "ControlHorizon" property of the "mpc" object is empty. Assuming 2.
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.

Specify an integral absolute error performance function and set the performance weights.

PerfFunc = 'IAE';
PerfWts.OutputVariables = [1 0.5];
PerfWts.ManipulatedVariables = zeros(1,3);
PerfWts.ManipulatedVariablesRate = zeros(1,3);

Define a 20 second simulation scenario with a unit step in the output 1 setpoint and a setpoint of zero for output 2.

Tstop = 20;
r = [1 0];

Define the nominal values of the manipulated variables to be zeros.

utarget = zeros(1,3);

Calculate the performance metric, J, and sensitivities, sens, for the specified controller and simulation scenario.

[J,sens] = sensitivity(MPCobj,PerfFunc,PerfWts,Tstop,r,[],[],utarget);
-->Converting model to discrete time.
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
-->Assuming output disturbance added to measured output channel #2 is integrated white noise.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

Input Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, use mpc.

PerfFunc must be one of the following:

'ISE' (integral squared error) for which the performance metric is

J=i=1Ns(j=1ny(wjyeyij)2+j=1nu[(wjueuij)2+(wjΔuΔuij)2])

'IAE' (integral absolute error) for which the performance metric is

J=i=1Ns(j=1ny|wjyeyij|+j=1nu(|wjueuij|+|wjΔuΔuij|))

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

J=i=1NsiΔt(j=1ny(wjyeyij)2+j=1nu[(wjueuij)2+(wjΔuΔuij)2])

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

J=i=1NsiΔt(j=1ny|wjyeyij|+j=1nu(|wjueuij|+|wjΔuΔuij|))

In the above expressions ny is the number of controlled outputs and nu is the number of manipulated variables. eyij is the difference between output j and its setpoint (or reference) value at time interval i. euij is the difference between manipulated variable j and its target at time interval i.

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

Example: 'ITAE'

The w parameters are nonnegative performance weights defined by the structure PerfWeights, which contains the following fields:

  • OutputVariablesny element row vector that contains the wjy values

  • ManipulatedVariablesnu element row vector that contains the wju values

  • ManipulatedVariablesRatenu element row vector that contains the wjΔu values

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.

Number of simulation steps, specified as a positive integer.

If you omit Ns, the default value is the row size of whichever of the following arrays has the largest row size:

  • The input argument r

  • The input argument v

  • The UnmeasuredDisturbance property of SimOptions, if specified

  • The OutputNoise property of SimOptions, if specified

Example: 100

Reference signal, specified as an array. This array has ny columns, where ny is the number of plant outputs. r can have anywhere from 1 to Ns rows. If the number of rows is less than Ns, the missing rows are set equal to the last row.

Example: ones(100,1)

Measured disturbance signal, specified as an array. This array has nv columns, where nv is the number of measured input disturbances. v can have anywhere from 1 to Ns rows. If the number of rows is less than Ns, the missing rows are set equal to the last row.

Example: [zeros(50,1);ones(50,1)]

Use a simulation options objects to specify options such as noise and disturbance signals that feed into the plant but are unknown to the controller. You can also use this object to specify an open loop scenario, or a plant model in the loop that is different from the one in MPCobj.Model.Plant.

For more information, see mpcsimopt.

The optional input utarget is a vector of nu manipulated variable targets. Their defaults are the nominal values of the manipulated variables. Δuij is the change in manipulated variable j and its target at time interval i.

Example: [0.1;0;-0.2]

Output Arguments

collapse all

Depending on the PerfFunc argument, this performance measure can be a function of the integral (time-weighted or not) of either the square or the absolute value or the (output and input) error. See PerfFunc for more detail.

This structure contains and the numerical partial derivatives of the performance measure J with respect to its diagonal weights. These partial derivatives, also called sensitivities, suggest weight adjustments that should improve performance; that is, reduce J.

See Also

|

Introduced in R2009a