CATIA-Systems / FMIKit-Simulink

Import and export Functional Mock-up Units with Simulink
Other
155 stars 50 forks source link

Unable to export S-Function model to FMU with release 3.0 using rtwsfcnfmi TLC #424

Open Gunasekaran145333 opened 1 year ago

Gunasekaran145333 commented 1 year ago

I created an S-function using a basic gain block paired with a constant. Using the .mexw64 file in the generate S function block and attempting to build FMU, an error occurs as the call to rtwsfcnfmi_make_rtw_hook, during the after_make hook generated the following error: Failed to build FMU.

Generate S Function Block Error

Please help me to resolve this issue

TPfitzer commented 1 year ago

You need to read the Info above the marked error: e.g. in your case the include file 'Trail_sf.h' is missing

Gunasekaran145333 commented 1 year ago

@TPfitzer . I checked, the file (Trail_sf.h) is already in the path.

TPfitzer commented 1 year ago

@TPfitzer . I checked, the file (Trail_sf.h) is already in the path.

Note its not enough to have it in your matlabpath. The FMIKit will create a new build-folder "...fmi..." and all the files needed to be present there. So you need to add them within you simulink configuration or if you have a more complex setup you could use the packNGo feature of matlab.

Gunasekaran145333 commented 1 year ago

@TPfitzer . In the Simulink configuration, I have included all of the source and header files. However, the same problem continues to appear; I have attached photos of the configuration parameters that I have provided.

Config1 Config2

Error Error_

In its essence, we are trying to build FMU for an S-function (Using the .mexw64 file in the generate S function block) using FMI Kit 3.0. Please provide the steps and settings to be kept in Simulink configuration settings. It would be great if you could assist me in resolving this.

TPfitzer commented 1 year ago

Maybe now i got it you try to build the fmu with only the mex-file and without having the c-code? If this is the case then i don't know if this is possible at all

Gunasekaran145333 commented 1 year ago

No, we have source codes for the S-function. It is given in the MATLAB Path as well as in Simulink configuration as you said, but still, it doesn't work. It throws an error as unable to find Subsystem_sf.h file (But is given in both Matlab Path and in Simulink configuration.

FYI Config1

Gunasekaran145333 commented 1 year ago

@TPfitzer, any idea to resolve the above-mentioned issue?