How to save MPC (model predictive controller) to be used later on? The error message is attached.

51 ビュー (過去 30 日間)
Ismaeel
Ismaeel 2018 年 6 月 3 日
コメント済み: Lana Khaleel 2023 年 12 月 28 日
I have designed an MPC controller in Simulink, and it works well as long as I don't exit-reopen MATLAB or don't clear the workspace. Once I clear it or exit, the following error I get (attached) when I run the Simulink model. How one can save the designed controller to be used later on? Thanks in advance

回答 (3 件)

VAN NGOC MAI
VAN NGOC MAI 2018 年 8 月 3 日
I am also facing this problem. Did you find out the solution for this one?

Andrés Duque Amaya
Andrés Duque Amaya 2018 年 11 月 1 日
I have the same problem. Furthermore,when I apply dynamic optimization from a m-file,the simulink model don't evaluate the MPC controller structure.

Jon
Jon 2019 年 10 月 10 日
編集済み: Jon 2019 年 10 月 10 日
A way around this problem is to:
1) Design your controller
2) Export your controller to the workspace
3) Save your controller in a .mat file and
4) Reload it before running the simulation.
So after designing the controller you could export your controller to the workspace (an option in the mpc designer app), then save your controller using:
save('MPC01.mat','MPC01')
later, when you want to rerun the simulation using your controller load it first using:
load MPC01
Obviously if your controller has another name then use that instead of MPC01
While this works it seems like a kludgey approach. I would have expected that the currently designed controller would automatically be saved with the Simulink model. Maybe the developers can take note.
p.s. I noticed you asked this about a year ago. I am running 2019b and experience the same issue you described. The solution I outlined will work, but in the meantime have you found any other solution?
  4 件のコメント
Jon
Jon 2022 年 6 月 14 日
It ran on my small example problem. When you say "it doesn't work actually" can you please be more specific, error messages, some other problem.
Lana Khaleel
Lana Khaleel 2023 年 12 月 28 日
the same error still appeared

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

カテゴリ

Help Center および File ExchangeController Creation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by