quadprog fails because of unrelated code

4 ビュー (過去 30 日間)
GuiRitter
GuiRitter 2017 年 12 月 19 日
コメント済み: GuiRitter 2017 年 12 月 19 日
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.

採用された回答

Walter Roberson
Walter Roberson 2017 年 12 月 19 日
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 件のコメント
GuiRitter
GuiRitter 2017 年 12 月 19 日
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!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModel Predictive Control Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by