I got an error when I tried to simulate my simulink model with an FMU from KULI SW (1-D Modelling tool)

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 .

Answers (1)

Following are the troubleshooting steps that you can try to resolve the issue:
  • 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.
Hope this helps!

Products

Release

R2023b

Asked:

on 10 Apr 2025

Edited:

on 10 Jul 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!