Code generation for an S-function

85 ビュー (過去 30 日間)
Anh
Anh 2024 年 10 月 18 日
編集済み: Kanishk 2024 年 11 月 13 日 12:35
Dear community,
I have a custom C file, generated from casadi tool, that is integrated into a wrapper and called sucessfully by an S-function block in a Simulink model. Simulation is working properly. Now I am struggling with the code generation for this simulink model for the implementation in a microcontroller. The custom C file has dependencies on the IPOPT library, so when generating C code for the Simulink model, it complains unrecognized symbols as in the picture below.
After having crossed some posts, I have learnt that, the file rtwmakecfg.m should be created and left in the same folder of the .mex file. In this file, the library 'ipopt.lib' is also included in the field makeInfo.linkLibsObjs.
The file ipopt.lib is actually left in the same folder. However, the code generation still fails as in the following picture. The .lib file doesn't seem recognized.
I am confused here, because the .lib file is in the same folder with the .mex and rtwmakecfg.m. Could you please share with me how to resolve the issue? Thanks in advance!
Best regards,
Anh
  1 件のコメント
Hitesh
Hitesh 2024 年 10 月 21 日
Hi @Anh
Could you provide your files so I can reproduce the error on my end and investigate its root cause further?

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

回答 (1 件)

Kanishk
Kanishk 2024 年 11 月 13 日 12:32
編集済み: Kanishk 2024 年 11 月 13 日 12:35
Hi @Anh,
I went through the documentation of CasADi tool. Although it supports self-contained C-code for a large subset of function objects, but code generation is not supported for ipopt” as of CasADi 3.5.
Here is a blog by CasADi to use "ipopt" with Simulink. They are using S-function dependent on CasADi runtime.
Hope this helps!
Thanks

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by