Does Simulink Coder support code generation of custom solver functions for Nonlinear MPC blocks?
1 次查看(过去 30 天)
显示 更早的评论
I have designed a nonlinear model predictive controller using
MpcObj = nlmpc(nx,ny,nu);
Since I want to use my own solver I have set the according property, i.e.,
MpcObj.Optimization.CustomSolverFcn = "CustomSolverInterface"
Using MpcObj, I prepared a Simulink model calling this object via the Nonlinear MPC block. When running in Simulink, the outputs are as expected.
So I built C-code using the Simulink Coder add-on. Doing so yields an executable which generats a logging file where I can inspect the outputs. However, they now have the same trajectory as if I had used fmincon instead of my custom solver.
So I am wondering whether Simulink Coder supports code generation with custom solvers. If yes, what are the limitations for that?
Best,
Arnold
0 个评论
采纳的回答
Emmanouil Tzorakoleftherakis
2023-1-27
Hi Arnold,
Unfortunately, right now you can only generate code using 'fmincon'. Custom nlp solvers can currently only be used for simulation. I have let the development team know about this and we will take a look at a future release.
Thanks for bringing this workflow to our attention
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Code Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!