validateFcns
Examine prediction model and custom functions of nlmpc
or
nlmpcMultistage
objects for potential problems
Syntax
Description
validateFunctions
tests the prediction model, custom cost,
custom constraint, and Jacobian functions of a nonlinear MPC controller for potential problems
such as whether information is missing, whether input and output arguments of any user
supplied functions are incompatible with object settings or whether user supplied analytical
gradient/Jacobian functions are numerically accurate. When you first design your nonlinear MPC
controller, or when you make significant changes to an existing controller, it is best
practice to validate your controller functions.
Nonlinear MPC
validateFcns(
tests the functions of nonlinear MPC controller nlmpcobj
,x
,mv
)nlmpcobj
for
potential problems. The functions are tested using specified state and manipulated
variable values, x
and mv
, respectively. These
values can represent nominal conditions or an arbitrary operating point. Use this syntax
if your controller has no measured disturbances and no parameters.
validateFcns(
specifies parameter values. If your controller has parameters, you must specify
nlmpcobj
,x
,mv
,md
,parameters
)parameters
.
Multistage Nonlinear MPC
validateFcns(
tests the functions of multistage nonlinear MPC controller nlmpcMSobj
,x
,mv
)nlmpcMSobj
for potential problems. The functions are tested using the specified state and manipulated
variable values, x
and mv
, respectively. These
values can represent nominal conditions or an arbitrary operating point. Use this syntax
if your controller has no measured disturbances and no parameters.
validateFcns(
specifies the additional nlmpcMSobj
,x
,mv
,simdata
)simdata
structure. If parameters are needed
for the state and stage functions, you need to provide them in
simdata
.
Examples
Input Arguments
Tips
When you provide your own analytical Jacobian functions, it is especially important that these functions return valid Jacobian values. If
validateFunctions
detects large differences between the values returned by your user-defined Jacobian functions and the finite-difference approximation, verify the code in your Jacobian implementations.
Algorithms
For each controller function, validateFunctions
checks whether the
function:
Exists on the MATLAB® path
Has the required number of input arguments
Can be executed successfully without errors
Returns the output arguments with the correct size and dimensions
Returns valid numerical data; that is, it does not return
Inf
orNaN
values
For Jacobian functions, validateFunctions
checks whether the returned
values are comparable to a finite-difference approximation of the Jacobian values. These
finite-difference values are computed using numerical perturbation.
Version History
Introduced in R2018b
See Also
Functions
generateJacobianFunction
|nlmpcmove
|nlmpcmoveCodeGeneration
|getSimulationData
|getCodeGenerationData