Does Simulink Coder support code generation of custom solver functions for Nonlinear MPC blocks?
조회 수: 9 (최근 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!