Syntax
Description
options = mpcmoveopt creates
an mpcmoveopt object, with default values for its
properties. Use this object with mpcmove to allow
runtime adjustment of the weights and constraints of the Model Predictive
Controller, an mpc object, that is operating.
Output Arguments
options 
Options for the mpcmove command with the
following fields:
OutputWeights — 1byn_{y} vector
of output variable tuning weights, where n_{y} is
the number of output variables.mpcmove replaces
the Weight.OutputVariables field of the corresponding mpc object
with this vector. The weights must be finite and real values. MVRateWeights — 1byn_{u} vector
of manipulated variable rate tuning weights, where n_{u} is
the number of manipulated variables. mpcmove replaces
the Weight.ManipulatedVariablesRate field of the
corresponding mpc object with this vector. The
weights must be finite and real values. ECRWeight — Scalar weight on the slack variable
used for constraint softening. mpcmove replaces
the Weight.ECR field of the corresponding mpc object
with this value. The weight must be a finite and real value. OutputMin — 1byn_{y} vector
of lower bounds on the output variables, where n_{y} is
the number of output variables. mpcmove replaces
the OutputVariables(i).Min field of the corresponding mpc object
with this vector, for i = 1,...,ny. OutputMax — 1byn_{y} vector
of upper bounds on the output variables, where n_{y} is
the number of output variables. mpcmove replaces
the OutputVariables(i).Max field of the corresponding mpc object
with this vector, for i = 1,...,ny. MVMin — 1byn_{u} vector
of lower bounds on the manipulated variables, where n_{u} is
the number of manipulated variables. mpcmove replaces
the ManipulatedVariables(i).Min field of the corresponding mpc object
with this vector, for i = 1,...,nu. MVMax — 1byn_{u} vector
of upper bounds on the manipulated variables, where n_{u} is
the number of manipulated variables. mpcmove replaces
the ManipulatedVariables(i).Max field of the corresponding mpc object
with this vector, for i = 1,...,nu. OnlyComputeCost — Logical value to control
whether the optimal sequence is to be calculated and exported. 0 (default) sets mpcmove to
compute and return the optimal cost and the optimal sequence of the
Model Predictive Controller objective function. 1 sets mpcmove to
compute and return only the optimal cost of the Model Predictive Controller
objective function.

Examples
Use an mpcmoveopt object to vary an MV
upper bound during a simulation employing mpcmove.
The upper bound decreases stepwise from 2 to 1 when elapsed time
exceeds 4 seconds. Also, setting OnlyComputeCost = 1 causes
the Info object returned by mpcmove to
contain the cost only.
Define an mpcmoveopt object and initialize
some of its fields.
OPTobj = mpcmoveopt;
OPTobj.OnlyComputeCost = true;
OPTobj.MVMin = 2;
Define a plant model and a model predictive controller object.
ts = 2;
Plant = ss(0.8, 0.5, 0.25, 0, ts);
MPCobj = mpc(Plant, ts);
MPCobj.MV(1).Min = 2;
MPCobj.MV(1).Max = 2;
Perform mpcmove simulation.
x = mpcstate(MPCobj);
r = 1;
v = [];
t = [0:ts:10];
N = length(t);
y = zeros(N,1);
u = zeros(N,1);
for i = 1:N
y(i) = 0.25*x.Plant;
% Use the MPCMOVEOPT object to modify the MV upper bound in
% real time.
if t(i) <= 4
OPTobj.MVMax = 2;
else
OPTobj.MVMax = 1;
end
[u(i), Info] = mpcmove(MPCobj, x, y(i), r, v, OPTobj);
end
Analyze the results.
[ts, us] = stairs(t, u);
plot(ts, us,'b', t, y,'r')
legend('Reference','Output');
Alternatives
When you use mpcmove, an mpcmoveopt object
is optional. As an alternative, you can modify the weight, constraint
definitions, or both before calling mpcmove.
This approach is usually less computationally efficient, but it avoids
potential conflicts with constraint definitions when mixed bounded
and unbounded variables are present.
More About
expand all
The number of manipulated variables (n_{u})
and output variables (n_{y})
for the mpcmoveopt object must match that of
the corresponding mpc object.
If any weight property in options is
set to [] (default), mpcmove uses
the corresponding weight specified in the mpc object.
In general, constraint specifications of options must be consistent with those
of the corresponding mpc object.
If all of the four constraint properties of options are set to [] (default), mpcmove uses
the existing constraints specified for the corresponding mpc object.
The result will be the same as if there are no runtime constraint
changes.
Otherwise:
Constraints set to [] are treated
as unbounded signals. The corresponding constraint settings for the mpc object
must also be unbounded.
Constraints not set to [] are treated
as bounded signals. The corresponding constraint settings for the mpc object
must also be bounded.
These requirements make the Model Predictive Controller object
behave consistently with the corresponding MPC Controller block
in Simulink^{®}
A conflict may arise when you have a mixture of bounded and
unbounded variables for one or more constraint properties of options. It may be resolved by defining
compatible constraints for the mpc object and
corresponding mpcmoveopt object.
For example, suppose n_{y} =
2, and your mpc object defines a maximum for
the first output variable but the second has no upper bound. If,
options.OutputMax = [],
then mpcmove interprets this as an attempt to
remove the upper bound on the first output.
options.OutputMax is
not [], then, because all entries must be finite, mpcmove interprets
this as an attempt to impose a new upper bound on the second output.
To avoid this conflict, modify your mpc object
to have a large but finite upper bound on the second output. It can
then be paired with options,
containing finite OutputMax values, without conflict.
See Also
mpc  mpcmove  setconstraint  setterminal