CD Implement MPC Controller VI

Control Design VI and Function

CD Implement MPC Controller VI

Owning Palette: Predictive Control VIs

Installed With: Control Design and Simulation Module

Calculates the Control Action u(k) to apply to the plant. This VI uses the Output Reference Window, Disturbance Window, and Control Action Reference Window parameters to calculate the control action along the control horizon at time k.

Note  Refer to Chapter 18, Creating and Implementing a Model Predictive Controller, of the LabVIEW Control Design User Manual for information about using this VI.

Use the pull-down menu to select an instance of this VI.

 Place on the block diagram  Find on the Functions palette

CD Implement MPC Controller (MIMO)

Manual? is TRUE if you want to provide the Control Action u(k) by wiring values to the Manual Control Action parameter. Manual? is FALSE if you want the MPC Controller to calculate the Control Action u(k). The default value is FALSE.
Manual Control Action specifies the values to use for the Control Action u(k). This parameter is valid only if you specify TRUE for the Manual? parameter.
Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
MPC Controller specifies the predictive controller model this VI uses. You create this model by using the CD Create MPC Controller VI.
Output Reference Window specifies the interleaved values of the plant output setpoints. This window applies to the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.
Disturbance Window specifies the interleaved values of the disturbance that affects the plant outputs. This window applies to the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.
Control Action Reference Window specifies the interleaved values of the control action setpoints. This window is for the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.

National Instruments recommends that you specify Control Action Reference Window for systems with more inputs than outputs.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
Measured Output y(k) specifies the measured outputs of the plant at the current sample time k. You can obtain these outputs by using sensors to measure the plant output.
Note  If you are simulating the MPC controller, you can use the Discrete State-Space function to represent the plant.
Estimated State xhat(k) specifies the estimated values of the plant states at the current sample time k. Providing state values is optional but improves the accuracy of the MPC Controller.
Note  If you do not wire a value to this parameter, you can estimate these states by using the CD Create MPC Controller VI to define a state estimator. You also can use the Discrete State-Space function to simulate the plant and obtain the actual state values.
Measured Control Action u(k–1) specifies the measured control action from the previous sample time k–1. This information is useful because the actuator might not be able to implement the Control Action u(k) this VI returns. In this situation, the MPC Controller takes the limitations of the actuator into account.
Note  If the Control Action u(k) differs from the Measured Control Action u(k–1), saturation might be present in the dynamic system.
Control Action u(k) returns the control action to apply to the plant at the current sample time k. This control action results in the Estimated Output yhat(k) from the plant.
MPC Final Conditions returns the final data for the MPC Controller.
Control Action (u) returns the current values of the control actions.
Output (y) returns the current values of the plant outputs.
Disturbance (d) returns the current values of the disturbance.
State (x) returns the current values of the plant states.
Control Action Change (Du) returns the current rates at which the control actions are changing.
Estimated Output yhat(k) returns the predicted output of the plant after applying all control action changes along the control horizon.
Lagrangian Multipliers returns the coefficients of the lagrangian function that corresponds to the equality and inequality constraints on the MPC controller.

For example, if you specified three equality constraints and two inequality constraints by using the MPC Optimization Parameters parameter of the CD Create MPC Controller VI, the first three values of the Lagrangian Multipliers parameter correspond to the equality constraints and the last two correspond to the inequality constraints.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

CD Implement MPC Controller (SISO)

Manual? is TRUE if you want to provide the Control Action u(k) by wiring values to the Manual Control Action parameter. Manual? is FALSE if you want the MPC Controller to calculate the Control Action u(k). The default value is FALSE.
Manual Control Action specifies the value to use for the Control Action u(k). This parameter is valid only if you specify TRUE for the Manual? parameter.
Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
MPC Controller specifies the predictive controller model this VI uses. You create this model by using the CD Create MPC Controller VI.
Output Reference Window specifies the interleaved values of the plant output setpoints. This window applies to the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.
Disturbance Window specifies the interleaved values of the disturbance that affects the plant outputs. This window applies to the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.
Control Action Reference Window specifies the interleaved values of the control action setpoints. This window is for the current prediction horizon. You can obtain this window by using either the CD Step Forward MPC Window VI or the CD Read MPC FIFO VI.

National Instruments recommends that you specify Control Action Reference Window for systems with more inputs than outputs.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
Measured Output y(k) specifies the measured output of the plant at the current sample time k. You can obtain this output by using sensors to measure the plant output.
Note  If you are simulating the MPC controller, you can use the Discrete State-Space function to represent the plant.
Estimated State xhat(k) specifies the estimated values of the plant states at the current sample time k. Providing state values is optional but improves the accuracy of the MPC Controller.
Note  If you do not wire a value to this parameter, you can estimate these states by using the CD Create MPC Controller VI to define a state estimator. You also can use the Discrete State-Space function to simulate the plant and obtain the actual state values.
Measured Control Action u(k–1) specifies the measured control action from the previous sample time k–1. This information is useful because the actuator might not be able to implement the Control Action u(k) this VI returns. In this situation, the MPC Controller takes the limitations of the actuator into account.
Note  If the Control Action u(k) differs from the Measured Control Action u(k–1), saturation might be present in the dynamic system.
Control Action u(k) returns the control action to apply to the plant at the current sample time k. This control action results in the Estimated Output yhat(k) from the plant.
MPC Final Conditions returns the final data for the MPC Controller.
Control Action (u) returns the current values of the control actions.
Output (y) returns the current values of the plant outputs.
Disturbance (d) returns the current values of the disturbance.
State (x) returns the current values of the plant states.
Control Action Change (Du) returns the current rates at which the control actions are changing.
Estimated Output yhat(k) returns the predicted output of the plant after applying the control action change along the control horizon.
Lagrangian Multipliers returns the coefficients of the lagrangian function that corresponds to the equality and inequality constraints on the MPC controller.

For example, if you specified three equality constraints and two inequality constraints by using the MPC Optimization Parameters parameter of the CD Create MPC Controller VI, the first three values of the Lagrangian Multipliers parameter correspond to the equality constraints and the last two correspond to the inequality constraints.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.