Why are neccesary the nominal conditions to build the MPC using the command line example in Matlab???

1 view (last 30 days)
I have really desinged a Model Predictive Ccontrol using the GUI and simulink ( I think it is pretty easier), but the most of my code are command lines in m-files, and is more "easy" to me programming comand lines for just one control than change everything, so I need to desing a MPC using command lines. When I checked the demostration example in matlab help "Simulations Involving Nonlinear Plants", I know is neccesary to initialize the mpc with mpcstate command, but why are neccesary the nominal conditions to build the MPC???, in the help example the code is:
% Set nominal conditions to the latest values
Model.Nominal.U = [0 0 u];
Model.Nominal.X = xp;
Model.Nominal.Y = yp;
dt = 0.001;
Options = simset('InitialState', xp);
[T, XP, YP] = sim('CSTR_INOUT', [t t+dt], Options, ...
[t up; t+dt up]);
Model.Nominal.DX = (1/dt)*(XP(end,:)' - xp(:));
in special the line
Model.Nominal.DX = (1/dt)*(XP(end,:)' - xp(:));
I don't understand very well this lines, so I think my code error have to do with this, becouse In the program execution I have the next error:
Error using internal.matlab.Message/getString
Incorrect number of parameters supplied for 'MPC:computation:InvalidMeasurementSize'. Expected 2 but found 1.
Error in ctrlMsgUtils.message (line 10)
Str = mObj.getString;
Error in ctrlMsgUtils.error (line 23)
msg.message = ctrlMsgUtils.message(errId, varargin{:});
Error in mpc/mpcmove (line 169)
ctrlMsgUtils.error('MPC:computation:InvalidMeasurementSize',nym);
Error in FormuMPC (line 43)
QE = mpcmove(ModeloMPCd, x,yp', [0 r], []);
I

Answers (1)

Arkadiy Turevskiy
Arkadiy Turevskiy on 27 Sep 2013
From the examination of the error message it appears the error has nothing to do with "nominal conditions" you mention, and instead is the result of the model specifying two measurements while your supplied measurement signal yp contains just one.

Community Treasure Hunt

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

Start Hunting!