how to export simulink-model which contains s-function block(&mex-file) to stand alone FMU?
25 views (last 30 days)
Show older comments
I have a question about how to export a standalone FMU.
How can I export a Simulink model containing an S-function block as a standalone FMU?
I exported it referring to the following, but the error described below appears.
The error message says "S-Function module not found", but the mex file exists on the MATLAB path and can be executed as a Simulink model.
I would be grateful if you could let me know if there is any work required for the export.
>Error message)
The S-Function module'model_hoge_sfunc_block' cannot be found.
The S-Function module must exist as a source file or precompiled object file on the MATLAB path.
>reference link)
0 Comments
Answers (1)
Wenhan Huang
on 30 Jul 2021
Hi 幸村,
I understand that you would like to export a Simulink Model with S-Function Block as a standalone FMU.
Based on the error message you provided, I suspect that S-Function Block is can only detect the mex binaries but not the source code. For Simulink to generate code for this case, you will need to provide either source code or object file of the S-Function. I recommend you place the S-Function source code next to your mex file so that S-Function block can located it.
I attached a small example to export a timestwo s-function as FMU in 2020a for your reference. Please see the attachment.
Wenhan
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!