非線形MPCブロック​についての質問(入力​部分のrefの扱いに​ついて)

非線形MPCブロックについて質問です。
非線形MPCブロックのrefへの入力を目標値ではなく、パラメータとして扱い、下記のリンクのようにカスタムコスト関数を用いて最適化を行いたいと考えています。
そこで質問です。matlabスクリプトでrefのパラメータを定義するときの書き方はどのようにしたらよいでしょうか。
Optimization.CustomCostFcn = "myCostFunction" ;
関数J = myCostFunction(X,U,e,data)
% refへの入力をSとする
S = nlobj.data.Referenses
このような形ですとエラーがでるので問い合わせさせていただきました。よろしくお願いします。

 Accepted Answer

Toshinobu Shintai
Toshinobu Shintai on 17 May 2023

0 votes

以下のデモモデルをご参照ください。
このデモモデルでは、以下のように4要素のベクトルがrefに入力されていますので、
カスタムコスト関数「oxidationCostFcn.m」に、例えば「data.Referenses(1)」と記述すると、refに入力されたベクトルの1番目の要素にアクセスできていることが分かります。

1 Comment

Ren
Ren on 17 May 2023
わかりやすいご説明ありがとうございます.試してみます.

Sign in to comment.

More Answers (0)

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Products

Release

R2023a

Asked:

Ren
on 17 May 2023

Commented:

Ren
on 17 May 2023

Community Treasure Hunt

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

Start Hunting!