How to define the ControllerInitialState in Model Predictive Control Toolbox?

2 views (last 30 days)
Hello, Im trying to simulate a nonlinearplant with a linear Model Predictive Controller in MPC toolbox. Im trying to design the controller by simulink and by the command line. I am a new with Matlab/Simulink by the way. I linearized the plant by myself, and I can simulate it against the nonlinear plant through Simulink and against the linearized plant through command line.
The problem arises when I want to define the last move of the controller, the initial state of the controller. I dont know how to do it. In the Model Predictive Control Toolbox™ Reference it is explained in page 1-92, but when I try to run in my code options.ControllerInitialState = Ulastmove being ulastmove the vector with the nominal value (or whatever) of the plant I have the next error:
"Error using mpc/sim (line 130) The "ControllerInitialState" property of "mpcsimopt" object must be a valid MPCSTATE object. Type "help mpcstate" for more information.
Error in mpc2dcommandlinecleanv2 (line 207) sim(MPCobj, Tstop, r, options)"
I dont understand, I tried to create an object called xmpc = mpcstate(MPCobj) as explanied in 1-96 of the reference, but I cant provocate that the last move before simulations is what I define previously.
Any help is welcome. I can provide more info if necessary. Thanks in advance. *******************
Edit: Solved

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!