This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Multiple Explicit MPC Controllers

Simulate switching between multiple explicit MPC controllers

Library

MPC Simulink Library

Description

The Multiple Explicit MPC Controllers block uses the following input signals:

  • Measured plant outputs (mo)

  • Reference or setpoint (ref)

  • Measured plant disturbance (md), if any

  • Switching signal (switch)

The switching signal selects the active controller from among a list of two or more candidate controllers. However, for the Multiple Explicit MPC Controllers block, the candidates are explicit MPC controllers. These controllers reduce online computational effort by using a table-lookup control law during each control interval rather than solving a quadratic program. For more information, see Explicit MPC Controller.

The Multiple Explicit MPC Controllers block enables you to transition between multiple explicit MPC controllers in real time based on the current operating conditions. Typically, you design each controller for a particular region of the operating space. Using available measurements, you detect the current operating region and select the appropriate active controller via the switch inport.

To improve efficiency, inactive controllers do not evaluate their control law. However, to provide bumpless transfer between controllers, the inactive controllers continue to perform state estimation.

Like for the Multiple MPC Controllers block, you cannot disable evaluation for the Multiple Explicit MPC Controllers. One controller must always be active.

Like the Explicit MPC Controller block, the Multiple Explicit MPC Controllers supports only a subset of optional MPC features, as outlined in the following table.

Supported FeaturesUnsupported Features
  • Custom state estimation (default state estimation uses a static Kalman filter)

  • Outport for state estimation results

  • External manipulated variable feedback signal inport

  • Single-precision block data (default is double precision)

  • Inherited sample time

  • Online tuning (penalty weight adjustments)

  • Online constraint adjustments

  • Online manipulated variable target adjustments

  • Reference and/or measured disturbance previewing

Dialog Box

The Multiple Explicit MPC Controller block has the following parameter groupings:

Parameters

Cell Array of Explicit MPC Controllers

Candidate controllers, specified as:

  • A cell array of Explicit MPC controller objects. Use the generateExplicitMPC command to create these objects.

  • A cell array of character vectors, where each element is the name of an explicit MPC controller object in the MATLAB® workspace.

The specified array must contain at least two candidate controllers. The first entry in the cell array is the controller that corresponds to a switch input value of 1, the second corresponds to a switch input value of 2, and so on.

Cell Array of Initial Controller States

Optional initial states for each candidate controller, specified as:

  • A cell array of mpcstate objects.

  • A cell array of character vectors, where each element is the name of an mpcstate object in the MATLAB workspace.

  • {[],[],...} or {'[]','[]',...} — Use the nominal condition defined in Model.Nominal as the initial state for each controller.

Required Inports

Controller Selection

The switch input signal must be a scalar integer between 1 and nc, where nc is the number of specified candidate controllers. At each control instant, this signal designates the active controller. A switch value of 1 corresponds to the first entry in the cell array of candidate controllers, a value of 2 corresponds to the second controller, and so on.

If the switch signal is outside of the range 1 and nc, the previous controller output is retained.

Measured output or State estimate

If candidate controllers use default state estimation, this inport is labeled mo. Connect this inport to the measured plant output signals.

If your candidate controllers use custom state estimation, check Use custom estimated states instead of measured outputs in the General section. Checking this option changes the label on this inport to x[k|k]. Connect a signal providing the controller state estimates. (The controller state includes the plant, disturbance, and noise model states.) The estimates supplied at time tk must be based on the measurements and other data available at time tk.

All candidate controllers must use the same state estimation option, either default or custom. When you use custom state estimation, all candidate controllers must have the same dimension.

Reference

At each control instant, the ref signal must contain the current reference values (targets or setpoints) for the ny output variables, where ny is the total number of outputs, including measured and unmeasured outputs. Since this block does not support reference previewing, ref cannot be defined as a matrix.

Required Outports

Manipulated Variables

The mv outport provides a signal defining the nu1 manipulated variables for controlling the plant. The active controller updates its manipulated variable output at each control instant using the control law contained in its explicit MPC controller object. If the control law evaluation fails, this signal is unchanged; that is, it is held at the previous successful result. The Multiple Explicit MPC Controller block passes the output of the active controller to the mv outport.

Additional Inports (General Section)

Measured disturbance

Add an inport (md) to which you can connect a vector signal containing nmd elements, where nmd is the number of measured disturbances.

Since this block does not support measured disturbance previewing, md cannot be defined as a matrix.

External manipulated variable

Add an inport (ext.mv) to which you connect a vector signal that contains the actual manipulated variables (MV) used in the plant. All candidate controllers use this signal to update their controller state estimates at each control interval. Using this inport improves state estimation accuracy when the MVs used in the plant differ from the MVs calculated by the block, for example due to signal saturation or an override condition.

For additional information, see the corresponding section of the MPC Controller block reference page.

Additional Outports (General Section)

Status of piecewise affine function evaluation

Add an outport (status) that indicates whether the latest explicit MPC control-law evaluation succeeded. The outport provides a scalar signal that has one of the following values:

  • 1 — Successful explicit control law evaluation

  • 0 — Failure: One or more control law parameters out of range.

  • –1 — Undefined: Control law parameters were within the valid range but an extrapolation was necessary.

If status is either 0 or –1, the mv outport remains at the last known good value.

Region number of evaluated piecewise affine function

Add an outport (region) providing the index of the polyhedral region used in the latest explicit control law evaluation (a scalar). If the control law evaluation fails, the signal at this outport equals zero.

Estimated plant, disturbance, and noise model states

Add an outport (est.state) for the controller state estimates, x[k|k], at each control instant. These estimates include the plant, disturbance, and noise model states.

State Estimation (General Section)

Use custom estimated states instead of measured outputs

Replace mo with the x[k|k] inport for custom state estimation as described in Required Inports. All candidate controllers must use the same state estimation option, either default or custom. When you use custom state estimation, all candidate controllers must have the same dimension.

Others Section

Block data type

Specify the block data type of the manipulated variables as one of the following:

  • double — Double-precision floating point (default)

  • single — Single-precision floating point

    If you are implementing the block on a single-precision target, specify the output data type as single.

For an example of double-precision and single-precision simulation and code generation for an MPC controller, see Simulation and Code Generation Using Simulink Coder.

To view the port data types in a model, in the Simulink® Editor, select Display > Signals & PortsPort Data Types.

Inherit sample time

Use the sample time of the parent subsystem as the block sample time. Doing so allows you to conditionally execute this block inside Function-Call Subsystem or Triggered Subsystem blocks. For an example, see Using MPC Controller Block Inside Function-Call and Triggered Subsystems.

Note

You must execute Function-Call Subsystem or Triggered Subsystem blocks at the sample rate of the controller. Otherwise, you can see unexpected results .

To view the sample time of a block, in the Simulink Editor, select Display > Sample Time. Select Colors, Annotations, or All. For more information, see View Sample Time Information (Simulink).

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Introduced in R2016b