Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMU export of system with embedded FMU does not work #257

Closed
matthiasliermann opened this issue Feb 2, 2021 · 7 comments
Closed

FMU export of system with embedded FMU does not work #257

matthiasliermann opened this issue Feb 2, 2021 · 7 comments

Comments

@matthiasliermann
Copy link

I created a simple model which includes an FMU generated with the FMIKit.
FMUinFMUtest
I export this model as an FMU again without errors or warnings, but the generated nested FMU does not execute. In Simulink the error message is:

Failed to instantiate FMU. The FMU crashed (exception code: ACCESS_VIOLATION).
Error in 'untitled/FMU' while executing C MEX S-function 'sfun_fmurun', (mdlStart), at time 0.0.
Caused by:
Unexpected Standard exception from MEX file.
What() is:Failed to instantiate FMU. The FMU crashed (exception code: ACCESS_VIOLATION).
.. 

With the FMU Simulator the message is:
Could not lad shared library. The specified module could not be found. (System Error 126)

Attached is my example code.

  • gain.slx: model containing a gain block (Matlab 2019b)
  • gain.fmu : cosimulation FMI 2 FMU of a simple model containing a gain block
  • integrator.slx: model containing a integrator block (Matlab 2019b)
  • integrator.fmu : cosimulation FMI 2 FMU of a simple model containing a integrator block
  • FMUinFMUtest.slx: model which contains the two FMUs
    FMUinFMUtest.zip
@matthiasliermann
Copy link
Author

Hello, I looked at that closed issue, which looks similar than mine.
issue 186
Do you have any idea what I need to do to create nested FMUs? Does it work with everyone else?

@chrbertsch
Copy link

You seem to use rtwsfcnfmi.tlc target. To my understanding, nested FMUs are only supported with the grtfmi.tlc target

@matthiasliermann
Copy link
Author

Thanks a lot! You are right. This is very helpful. Could you please help me to understand the underlying issue? I have generated my own FMU from c-code and can't get the nested sfunction to work with this one.

@t-sommer
Copy link
Contributor

Nested FMUs are not supported with rtwsfcnfmi.tlc.

@matthiasliermann
Copy link
Author

Thanks for the clarification. I understand that I can't use the sfunction FMI target. My goal is then to export an FMU with the grt fmi target of a system which includes a custom-made FMU. I made this FMU myself from scratch and would like to include in in a system which I want to export as an FMU with the FMIKit using the grt fmi target. Please point me in a direction what I need to do to get this to work. Thanks!

@t-sommer
Copy link
Contributor

The only requirement for exporting nested FMUs with grtfmi.tlc is that they have binaries for the platform you're exporting for. There is no source code required.

@hemant6043
Copy link

I am using an FMU export from Adams model and trying to run it in simulink and I am still getting this error
Error in 'test/FMU' while executing C MEX S-function 'sfun_fmurun', (mdlStart), at time 0.0.
Caused by:
Unexpected Standard exception from MEX file.
What() is:Failed to instantiate FMU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants