MATLAB: Do I get a “marshall.coerceToClass” error when simulating model containing Adaptive MPC block

adaptivecontrolsModel Predictive Control Toolboxmpcordertf

I'm using the Adaptive MPC block in my model and I run into the following error:
Size mismatch for MATLAB expression 'marshall.coerceToClass'. Expected = 3×3 Actual = 4×4
In my model, I'm sending a state space model as input to the 'Model' port of the Adaptive MPC block, and this model originates from within a MATLAB Function block called 'Time Predictive Model'. This is very similar to one of the examples provided in the MPC Toolbox documentation – https://www.mathworks.com/help/releases/R2018b/mpc/ug/time-varying-mpc-control-of-a-time-varying-linear-system.html
I initially suspected that the error was originating from within the ML Function block. When I reduced the number of poles and zeros in the transfer function (this is in the step before it is discretized and converted to state space), I found the model to run without errors. Therefore, I have the following questions:
– How do I increase the order of their transfer function without running into the above error?
– I'm mainly interested in implementing some version of Adaptive Control as they have a system that is time-varying. I currently use a modified version of the 'Time-Varying Plant' example linked above. Are there any other examples or functionalities I can use, either from the MPC Toolbox, or from the larger Controls Toolbox that would be suitable for a time-varying plant?

Best Answer

  1. In the Adaptive MPC block, the plant model is being specified by "mpcobj", which has 3 states, 1 input and 1 output. Therefore, the model provided to the Adaptive MPC block should also have 3 states, 1 input and 1 output. When the order of transfer function is increased within the 'Time Varying Predictive Model' block, the number of states after converting to state space becomes 4, and an error is thrown because mpcobj expects an order of 3. There are some ways to update the plant model and the predictive model during simulation. To explain this in more detail, I am including a couple of documentation links below:
https://www.mathworks.com/help/<https://www.mathworks.com/help/releases/R2018b/mpc/ref/mpc.mpcmoveadaptive.html#buik3vp-1-Plant releases/R2018b/mpc/ref/mpc.mpcmoveadaptive.html#buik3vp-1-Plant>
https://www.mathworks.com/help/<https://www.mathworks.com/help/mpc/examples.html?category=adaptive-mpc-design&s_tid=CRUX_gn_example releases/R2018b/><https://www.mathworks.com/help/mpc/ref/adaptivempccontroller.html#bugls7u-7 mpc/ref/adaptivempccontroller.html#bugls7u-7>
To avoid the error, please ensure that the Plant model for mpcobj and the model inports for Adaptive MPC controller are always consistent with each other. # Regarding resources on implementing Adaptive Control, please find below some examples on Adaptive MPC design:
The LPV (linear parameter varying) block in Control System Toolbox may also be helpful. See the link below:
https://www.mathworks.com/help/<https://www.mathworks.com/help/mpc/examples.html?category=adaptive-mpc-design&s_tid=CRUX_gn_example releases/R2018b/><https://www.mathworks.com/help/mpc/ug/adaptive-mpc-control-of-nonlinear-chemical-reactor-using-linear-parameter-varying-system.html mpc/ug/adaptive-mpc-control-of-nonlinear-chemical-reactor-using-linear-parameter-varying-system.html>
Related Question