Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mpcmoveopt

Options set for mpcmove and mpcmoveAdaptive

Syntax

options = mpcmoveopt

Description

options = mpcmoveopt creates an empty mpcmoveopt object. You can set one or more of its properties using dot notation. You can then use the object with mpcmove, mpcmoveAdaptive, or mpcmoveMultiple to simulate run-time adjustment of selected controller properties, such as tuning weights and bounds.

mpcmoveopt property dimensions must be consistent with the number of manipulated variables (nu) and output variables (ny) defined in the controller you are simulating.

In general, if you do not specify a value for one of the mpcmoveopt properties, it defaults to the corresponding built-in value of the simulated controller.

Output Arguments

options

Options for the mpcmove, mpcmoveAdaptive, or mpcmoveMultiple command, returned as a structure with the following fields.

PropertyDescriptionDefault
OutputWeightsOutput variable tuning weights, specified as an ny vector of nonnegative, finite real values. These values replace the Weight.OutputVariables property of the controller.[]
MVWeightsManipulated variable tuning weights, specified as a 1-by-nu vector of nonnegative, finite real values. These values replace the Weight.ManipulatedVariables property of the controller.[]
MVRateWeightsManipulated variable rate tuning weights, specified as a 1-by-nu vector of nonnegative, finite real values. These values replace the Weight.ManipulatedVariablesRate property of the controller.[]
ECRWeightWeight on the slack variable used for constraint softening, specified as a finite, real scalar. This value replaces the Weight.ECR property of the controller.[]
OutputMinLower bounds on the output variables, specified as a 1-by-ny vector. OutputMin(i) replaces the OutputVariables(i).Min property of the controller, for i = 1, …, ny.[]
OutputMaxUpper bounds on the output variables, specified as a 1-by-ny vector. OutputMax(i) replaces the OutputVariables(i).Max property of the controller, for i = 1, …, ny.[]
MVMinLower bounds on the manipulated variables, specified as a 1-by-nu vector. MVMin(i) replaces the ManipulatedVariables(i).Min property of the controller, for i = 1, …, nu.[]
MVMaxUpper bounds on the manipulated variables, specified as a 1-by-nu vector. MVMax(i) replaces the ManipulatedVariables(i).Max property of the controller, for i = 1, …, nu.[]
CustomConstraint

Custom constraints on linear combinations of plant inputs and outputs, specified as a structure with the following fields:

  • E — Manipulated variable constraint constant, specified as an nc-by-nu array, where nc is the number of constraints.

  • F — Controlled output constraint constant, specified as an nc-by-ny array.

  • G — Custom constraint constrant, specified as a column vector of length nc.

  • S — Measured disturbance constraint constant, specified as an nc-by-nv array, where nv is the number of measured disturbances.

These constraints replace the custom constraints previously set using setconstraint. The dimensions of E, F, G, and S must match the dimensions of the corresponding arrays set using setconstraint.

[]
OnlyComputeCost

Logical value that controls whether to calculate and export the optimal sequence.

  • 0 — Controller returns the predicted optimal policy in addition to the objective function cost value.

  • 1 — Controller returns the objective function cost only, which saves computational effort.

0
MVusedManipulated variable values used in the plant during the previous control interval, specified as a 1-by-nu vector. This property mimics the external MV signal for the MPC Controller or Adaptive MPC Controller blocks. If you do not provide an MVused value, the controller uses the LastMove property of mpcstate.[]
MVTargetManipulated variable target values, specified as a 1-by-nu vector. MVTarget(i) replaces the ManipulatedVariables(i).Target property of the controller, for i = 1, …, nu.[]

Examples

collapse all

Vary a manipulated variable upper bound during a simulation.

Define the plant, which includes a 4-second input delay. Convert to a delay-free, discrete, state-space model using a 2-second control interval. Create the corresponding default controller and then specify MV bounds at +/-2.

Ts = 2;
Plant = absorbDelay(c2d(ss(tf(0.8,[5 1],'InputDelay',4)),Ts));
MPCobj = mpc(Plant,Ts);
-->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.
MPCobj.MV(1).Min = -2; 
MPCobj.MV(1).Max = 2;

Create an empty mpcmoveopt object. During simulation, you can set properties of the object to specify controller parameters.

options = mpcmoveopt;

Pre-allocate storage and initialize the controller state.

v = []; 
t = [0:Ts:20]; 
N = length(t); 
y = zeros(N,1); 
u = zeros(N,1); 
x = mpcstate(MPCobj);
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

Use mpcmove to simulate the following:

  • Reference (setpoint) step change from initial condition r = 0 to r = 1 (servo response).

  • MV upper bound step decrease from 2 to 1, occurring at t = 10.

r = 1; 
for i = 1:N
    y(i) = Plant.C*x.Plant;
    if t(i) >= 10
        options.MVMax = 1; 
    end
    [u(i),Info] = mpcmove(MPCobj,x,y(i),r,v,options); 
end

As the loop executes, the value of options.MVMax is reset to 1 for all iterations that occur after t = 10. Prior to that iteration, options.MVMax is empty. Therefore, the controller's value for MVMax is used, MPCobj.MV(1).Max = 2.

Plot the results of the simulation.

[Ts,us] = stairs(t,u); 
plot(Ts,us,'b-',t,y,'r-') 
legend('MV','OV')
xlabel(sprintf('Time, %s',Plant.TimeUnit))

From the plot, you can observe that the original MV upper bound is active until t = 4. After the input delay of 4 seconds, the output variable (OV) moves smoothly to its new target of r = 1. reaching the target at t = 10. The new MV bound imposed at t = 10 becomes avtive immediately. This forces the OV below its target, after the input delay elapses.

Now assume that you want to impose an OV upper bound at a specified location relative to the OV target. Consider the following constraint design command:

MPCobj.OV(1).Max = [Inf,Inf,0.4,0.3,0.2];

This is a horizon-varying constraint. The known input delay makes it impossible for the controller to satisfy an OV constraint prior to the third prediction-horizon step. Therefore, a finite constraint during the first two steps would be poor practice. For illustrative purposes, the above constraint also decreases from 0.4 at step 3 to 0.2 at step 5 and thereafter.

The following commands produce the same results shown in the previous plot. The OV constraint is never active because it is being varied in concert with the setpoint, r.

x = mpcstate(MPCobj);
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
OPTobj = mpcmoveopt;
for i = 1:N
    y(i) = Plant.C*x.Plant;
    if t(i) >= 10
        OPTobj.MVMax = 1; 
    end
    OPTobj.OutputMax = r + 0.4;
    [u(i),Info] = mpcmove(MPCobj,x,y(i),r,v,OPTobj); 
end

The scalar value r + 0.4 replaces the first finite value in the MPCobj.OV(1).Max vector, and the remaining finite values adjust to maintain the original profile, i.e., the numerical difference between these values is unchanged. r = 1 for the simulation, so the above use of the mpcmoveopt object is equivalent to the command

MPCobj.OV(1).Max = [Inf, Inf, 1.4, 1.3, 1.2];

The use of the mpcmoveopt object involves much less computational overhead, however.

Tips

  • mpcmoveopt cannot constrain a variable that was unconstrained in the controller creation step. The controller ignores any such specifications. Similarly, you cannot eliminate a constraint defined during controller creation, but you can change it to a large (or small) value such that it is unlikely to become active.

  • If the controller design includes a vector constraint, the run-time mpcmoveopt value replaces the first finite entry, and the remaining values shift to retain the same constraint profile. See Simulation with Varying Controller Property.

Alternatives

The mpcmoveopt object is an optional feature of the mpcmove, mpcmoveAdaptive, and mpcmoveMultiple commands. The alternative is to redefine the controller and/or state object before each command invocation, which involves considerable overhead.

Introduced in R2011b

Was this topic helpful?