mpcqpsolver vs. quadprog for Model Predictive Control Problems

16 views (last 30 days)
Background: I'm trying to solve custom MPC problems and have 2015a but no access to 2015b at the moment. I was using one of the examples as a guide ( http://uk.mathworks.com/help/mpc/examples/solve-custom-mpc-quadratic-programming-problem-and-generate-code.html) and got everything to work fine until I got to the end and realised that mpcqpsolver is not available as part of 2015a. Using quadprog, I redefined the inequality constraints and used the Hessian as an input argument instead. The resulting solution matched that of the example which used mpcqpsolver instead.
Questions: Apart from the adoption of the KWIK algorithm, what are the benefits to solving MPC problems using mpcsolver instead of quadprog? It seems that you can pose the problem identically and the only difference is the QP solution.
One of the strengths of MPC is the ability to anticipate future events and provide control inputs in advance of some disturbance. How can this be implemented using MPC custom code? I have the following as part of my script to test the ability of the MPC code to reject disturbances, using the same system from the above, linked example:
for ct = t_constrained
if ct ==30
x = [0.5;-0.5];
else
x = x;
end
u = quadprog(H, F*x, Ac, b0);
uMPC(ct+1) = u(1);
x = A*x+B*uMPC(ct+1);
yMPC(ct+1) = C*x;
end
This simply defines x at t = 30s as having initial values of x0. This produces the following response:
I am using a prediction horizon of N = 6 and t_constrained = 1:60, but there is no anticipation of this future event. I realise that this will be because the algorithm has no conceptual understanding of the if statement which describes the disturbance but given so few opportunities to insert a disturbance into the custom code when calculating x at each time step, how else can it be done?
It is quite a lengthy question, thanks for taking the time to consider it.
EDIT: Forgot to also ask: if J = (1/2)*x'*H*x + f'*x is the objective function to be minimised, the MPC objective form has to be transformed into this form, for QP problems. This only allows you to minimise a single variable, instead of x,u, du etc... with the appropriate weighting matrices applied to each variable. Surely this is a weakness in this particular example i.e. custom MPC code? Since the Hessian is a function of an LTI system, it can't be updated. The answer to this question may also answer my second question, with regards to anticipating disturbances.

Answers (0)

Community Treasure Hunt

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

Start Hunting!