quadprog fails because of unrelated code
3 views (last 30 days)
Show older comments
I have a Simulink model that's supposed to simulate a Generalized Prediction Control on a plant. However, the quadprog function fails when I complete the code. When I delete part of the code, it works (but because the code is incomplete, the control as a whole doesn't work).
More specifically, in the attached model, in the "control block" subsystem, in the "controller" MATLAB Function, after line 58, I have this:
coder.extrinsic('quadprog');
U = zeros(size([0; 0; 0; 0]));
U = quadprog(H, b, [], [], [], [], [0; 0; 0; 0], [100; 100; 100; 100]);
f0 = ((F - W)') * (F - W);
u1 = u1m1 + U(1) + f0;
u2 = u2m1 + U(2) + f0;
As it is, it gives me:
An error occurred while running the simulation and the simulation was terminated
Caused by:
The interior-point-convex algorithm requires all objective and constraint values to be finite.
If I comment "+ f0", the simulation works but doesn't do what I'm expecting.
How do I make it work?
I'm using MATLAB R2017a on Debian 9.
Thanks in advance.
0 Comments
Accepted Answer
Walter Roberson
on 19 Dec 2017
Is there feedback from the output of the block to the input? If so then it is possible that at some point the output of becomes infinite, and then that infinite value gets fed back to becoming infinite input that gets complained about. When you comment out the two indicated lines, the output is U(1) and U(2) are not used and so infinite output would not end up as feedback.
More Answers (0)
See Also
Categories
Find more on Model Predictive Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!