mpcmoveExplicit

Compute optimal control using explicit MPC

Description

mv = mpcmoveExplicit(EMPCobj,x,ym,r,v) computes the optimal manipulated variable moves at the current time using an explicit model predictive control law. This result depends on the properties contained in the explicit MPC controller and the controller states. The result also depends on the measured output variables, the output references (setpoints), and the measured disturbance inputs. mpcmoveExplicit updates the controller state, x, when using default state estimation. Call mpcmoveExplicit repeatedly to simulate closed-loop model predictive control.

[mv,info] = mpcmoveExplicit(EMPCobj,x,ym,r,v) returns additional details about the computation in a structure. To determine whether the optimal control calculation completed normally, check the data in info.

[mv,info] = mpcmoveExplicit(EMPCobj,x,ym,r,v,MVused) specifies the manipulated variable values used in the previous mpcmoveExplicit command, allowing a command-line simulation to mimic the Explicit MPC Controller Simulink® block with the optional external MV input signal.

Input Arguments

collapse all

Explicit MPC controller to simulate, specified as an Explicit MPC controller object. Use generateExplicitMPC to create an explicit MPC controller.

Current MPC controller state, specified as an mpcstate object.

Before you begin a simulation with mpcmoveExplicit, initialize the controller state using x = mpcstate(EMPCobj). Then, modify the default properties of x as appropriate.

If you are using default state estimation, mpcmoveExplicit expects x to represent x[n|n-1]. The mpcmoveExplicit command updates the state values in the previous control interval with that information. Therefore, you should not programmatically update x at all. The default state estimator employs a linear time-varying Kalman filter.

If you are using custom state estimation, mpcmoveExplicit expects x to represent x[n|n]. Therefore, prior to each mpcmoveExplicit command, you must set x.Plant, x.Disturbance, and x.Noise to the best estimates of these states (using the latest measurements) at the current control interval.

Current measured outputs, specified as a row vector of length Nym, where Nym is the number of measured outputs. If you are using custom state estimation, ym is ignored. If you set ym = [], then mpcmoveExplicit uses the appropriate nominal value.

Plant output reference values, specified as a vector of length Ny. mpcmoveExplicit uses a constant reference for the entire prediction horizon. In contrast to mpcmove and mpcmoveAdaptive, mpcmoveExplicit does not support reference previewing.

If you set r = [], then mpcmoveExplicit uses the appropriate nominal value.

Current and anticipated measured disturbances, specified as a vector of length Nmd, where Nmd is the number of measured disturbances. In contrast to mpcmove and mpcmoveAdaptive, mpcmoveExplicit does not support disturbance previewing. If your plant model does not include measured disturbances, use v = [].

Manipulated variable values applied to the plant during the previous control interval, specified as a vector of length Nmv, where Nmv is the number of manipulated variables. If this is the first mpcmoveExplicit command in a simulation sequence, omit this argument. Otherwise, if the MVs calculated by mpcmoveExplicit in the previous interval were overridden, set MVused to the correct values in order to improve the controller state estimation accuracy. If you omit MVused, mpcmoveExplicit assumes MVused = x.LastMove.

Output Arguments

collapse all

Optimal manipulated variable moves, returned as a column vector of length Nmv, where Nmv is the number of manipulated variables.

If the controller detects an infeasible optimization problem or encounters numerical difficulties in solving an ill-conditioned optimization problem, mv remains at its most recent successful solution, x.LastMove.

Otherwise, if the optimization problem is feasible and the solver reaches the specified maximum number of iterations without finding an optimal solution, mv:

  • Remains at its most recent successful solution if the Optimizer.UseSuboptimalSolution property of the controller is false.

  • Is the suboptimal solution reached after the final iteration if the Optimizer.UseSuboptimalSolution property of the controller is true. For more information, see Suboptimal QP Solution.

Explicit MPC solution status, returned as a structure having the following fields.

Solution status code, returned as one of the following values:

  • 1 — Successful solution.

  • 0 — Failure. One or more controller input parameters is out of range.

  • –1 — Undefined. Parameters are in range but an extrapolation must be used.

Region to which current controller input parameters belong, returned as either a positive integer or 0. The integer value is the index of the polyhedron (region) to which the current controller input parameters belong. If the solution failed, Region = 0.

Tips

Introduced in R2014b