Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the 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, and then use the object with mpcmove or mpcmoveAdaptive 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 or mpcmoveAdaptive command with the following fields:

  • OutputWeights — Output variable tuning weights, specified as a 1-by-ny vector, where ny is the number of output variables. These values replace the Weight.OutputVariables property of the controller. The weights must be nonnegative, finite real values.

  • MVWeights — Manipulated variable tuning weights, specified as a 1-by-nu vector, where nu is the number of manipulated variables. These values replace the Weight.ManipulatedVariables property of the controller. The weights must be nonnegative, finite real values.

  • MVRateWeights — Manipulated variable rate tuning weights, specified as a 1-by-nu vector, where nu is the number of manipulated variables. These values replace the Weight.ManipulatedVariablesRate property of the controller. The weights must be nonnegative, finite real values.

  • ECRWeight — Weight on the slack variable used for constraint softening, specified as a finite, real scalar. This value replaces the Weight.ECR property of the controller.

  • OutputMin — Lower bounds on the output variables, specified as a 1-by-ny vector, where ny is the number of output variables. OutputMin(i) replaces the OutputVariables(i).Min property of the controller, for i = 1,...,ny.

  • OutputMax — Upper bounds on the output variables, specified as a 1-by-ny vector, where ny is the number of output variables. OutputMax(i) replaces the OutputVariables(i).Max property of the controller, for i = 1,...,ny.

  • MVMin — Lower bounds on the manipulated variables, specified as a 1-by-nu vector, where nu is the number of manipulated variables. MVMin(i) replaces the ManipulatedVariables(i).Min property of the controller, for i = 1,...,nu.

  • MVMax — Upper bounds on the manipulated variables, specified as a 1-by-nu vector, where nu is the number of manipulated variables. MVMax(i) replaces the ManipulatedVariables(i).Max property of the controller, for i = 1,...,nu.

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

    • 0 (default) causes the controller to return the predicted optimal policy in addition to the objective function cost value.

    • 1 causes the controller to return the objective function cost only, which saves computational effort.

  • MVused — Manipulated 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 Simulink® blocks. If you do not provide an MVused value, the controller uses the LastMove property of mpcstate.

  • MVTarget — Manipulated 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);
MPCobj.MV(1).Min = -2;
MPCobj.MV(1).Max = 2;
-->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.

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);
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
-->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.

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.

Alternatives

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

More About

collapse all

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 very 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.

Introduced in R2011b


Was this topic helpful?