quadprog fails because of unrelated code

4 vues (au cours des 30 derniers jours)
GuiRitter
GuiRitter le 19 Déc 2017
Commenté : GuiRitter le 19 Déc 2017
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 19 Déc 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.
  1 commentaire
GuiRitter
GuiRitter le 19 Déc 2017
You're right. I ran it for less time and found out the moment it "explodes". Turns out a sign was negated. It's working now, but still needs some work. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Model Predictive Control Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by