- Check FMI and FMU Type Compatibility: Confirm the FMU’s FMI version (1.0/2.0/3.0) and type (Co-Simulation or Model Exchange) are supported by your Simulink version, and use the correct FMU block.
- Set Appropriate Solver and Step Size: Use a fixed-step solver (like ode4 or discrete) and set the communication step size explicitly (e.g., 0.01), not as inherited.
- Configure FMU Block Parameters: Enable detailed logging in the FMU block and ensure all FMU inputs are connected with compatible data types.
- Check for DLLs and Dependencies: Ensure all DLLs that came with the FMU are present, unblocked (on Windows), and that the FMU’s file path has no spaces or special characters.
- Match Sample Time and Data Types: Align the Simulink sample time with the FMU’s expected step size, and use Data Type Conversion blocks if needed.
- Test with a Known-Good FMU: Import a simple, standard FMU (e.g., from FMI Cross-Check) into Simulink to confirm that your environment is set up correctly.
- Review Simulink Diagnostic Viewer: Check the Diagnostic Viewer after the error for more detailed messages that can pinpoint the cause.
I got an error when I tried to simulate my simulink model with an FMU from KULI SW (1-D Modelling tool)
1 次查看(过去 30 天)
显示 更早的评论
Error:An error occurred while running the simulation and the simulation was terminated
Caused by: Unexpected exception (class _com_error) was caught.
Tried to change the solver options from variable step to fixed step and vice versa and also change the communication step size in the FMU from inherited (-1) to 0 and 1 ... Nothing worked and am not able to understand if the issue is with my original 1-d model or the link between the FMU and the simulink. It would be great , if someone can help me sort this out .
0 个评论
回答(1 个)
Vidhi Agarwal
2025-7-10
Following are the troubleshooting steps that you can try to resolve the issue:
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!