CATIA-Systems / FMIKit-Simulink

Import and export Functional Mock-up Units with Simulink
Other
157 stars 51 forks source link

Can we export an Fmu of an sfunction model using only Mexw64 (without any other source codes) #426

Open Vasan794 opened 1 year ago

Vasan794 commented 1 year ago

image This my model which is using an mexfile of the sfunction which consists a simple gain block of value 5 and corresponding input output ports ....while building this model im facing an error that source files are missing ....i need to build it without source files ... is that possible if possible please let me know how to build it so that i can be able to build fmu out of it ..

t-sommer commented 1 year ago

Can you share a model and S-function to reproduce the problem?

chrbertsch commented 1 year ago

Do you use the rtwsfnc.tlc target and the option "Load S-functions from binary MEX files"? See https://github.com/CATIA-Systems/FMIKit-Simulink/blob/main/docs/fmu_export.md#s-function-based-fmu

Load S-functions from binary MEX files | selects that S-functions in the model will be loaded from pre-compiled binary MEX files instead of using stand-alone compilation of S-function sources. This option will create dependencies on MATLAB binaries, which are not included in the exported FMU. On Windows, the FMU will by default try to load these from the bin directory of the exporting MATLAB installation. The environment variable SFCN_FMI_MATLAB_BIN can be used to specify a different directory from where to load the MATLAB binaries (for example a MATLAB run-time installation). On Linux, it is required to use the environment variable LD_LIBRARY_PATH to specify the path to the MATLAB binaries. The S-function MEX files used by the model are copied to /resources/SFunctions of the FMU and are loaded automatically when the FMU is instantiated. -- | --