Importing FMU into a Simulink model
Mostra commenti meno recenti
We have a scenario where FMU is incorporated into a Simulink R2024A and exported it as a .slx. We have a Linux target where it is throwing error as "fatal error: rtwcg_fmu2_target.h: No such file or directory" when we compile them in our product.
- We need to know if this is a valid use case.
- If we try to include this file, we are getting other dependency files are not there.
How do we solve this issue
Risposte (1)
Aditya
il 17 Dic 2025
0 voti
Hi,
Answering your questions.
1) No, this is not a standard or supported workflow.
- FMU (Functional Mock-up Unit) blocks in Simulink are meant for simulation within Simulink, not for direct code generation and deployment as .slx models to external (Linux) targets.
- The generated code from a Simulink model that includes FMU blocks depends on MathWorks-internal support files (like rtwcg_fmu2_target.h), which are not open-source or distributed for external compilation.
Following are a few workarounds for the same
1. Simulation-only:
If you need to use FMUs, run the simulation inside Simulink. Code generation and deployment to external targets is not supported for FMU blocks.
2. For code generation/deployment:
- Remove FMU blocks from your model before generating code for deployment.
- If you need the FMU logic on your Linux target, consider:
- Running the FMU directly on Linux using an FMU runtime/library (e.g., FMPy, PyFMI, or C FMI APIs).
- Wrap the FMU as a C/C++ library and interface with your application, bypassing Simulink code generation.
Categorie
Scopri di più su FMU Importing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!