非線形モデル予測制御にカスタム評価関数の与え方

9 views (last 30 days)
Taisuke Hattori
Taisuke Hattori on 31 Jan 2020
Commented: Taisuke Hattori on 22 May 2020
非線形モデル予測制御を用いてモータの制御を行っています。
評価関数について質問があります。
標準の評価関数を用いずに以下の式を与えたい場合はどのように設定すれば良いのでしょうか?
評価関数.PNG
教えていただけると幸いです。
よろしくお願いいたします。

Accepted Answer

Kohei Iwamoto
Kohei Iwamoto on 20 May 2020
非線形MPCのカスタム評価関数の機能をご利用するのが良いかと思います。
カスタム評価関数は関数m-file、関数ハンドル、無名関数によって、以下のようにnlmpcオブジェクトに指定して与えることが出来ます。
nlobj.Optimization.CustomCostFcn = "myCostFunction";
評価関数の書き方の詳細については、以下のヘルプをご確認頂くと良いかと思いますが、プログラム上で状態量と入力を抽出し、終端を除く予測ステップ間はステージコストLの総和(sum)を計算し、終端コストphiは終端での状態量から計算し、両者を合算した値Jを戻り値とするという方法で実装できると考えられます。
  3 Comments
Kohei Iwamoto
Kohei Iwamoto on 21 May 2020
引数として重みなどのパラメーターを与えたいということかと思います。
それは可能です。ご紹介したヘルプにあるようにユーザー独自のパラメーターをカスタム関数に追加することが出来ます。
その場合には、以下の説明に従い、各関数やnlmpcオブジェクトに追加パラメーターを指定することになります。
Optional parameters, specified as a comma-separated list (for example p1,p2,p3). The same parameters are passed to the prediction model, custom cost function, and custom constraint functions of the controller. For example, if the state function uses only parameter p1, the constraint functions use only parameter p2, and the cost function uses only parameter p3, then all three parameters are passed to all of these functions.
If your model uses optional parameters, you must specify the number of parameters using the Model.NumberOfParameters property of the controller.
追加パラメーターをnlmpcオブジェクトに含める例として、以下になります。(追加パラメーターが一つの場合)
nlobj.Model.NumberOfParameters = 1;
Taisuke Hattori
Taisuke Hattori on 22 May 2020
ありがとうございます。
参考にさせていただきます。

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!