How to make an FMU debugging-friendly in Simulink?
6 views (last 30 days)
Show older comments
We are trying to develop an FMU that is compatible with Simulink. We are using Matlab 2023b+ on Windows x64. The FMU is FMI v3.0 and was originally generated using MSVC 2022 on Windows. The FMU only support co-simulation currently.
We are able to successfully use the FMU using `fmusim`, the executable provided here: https://github.com/modelica/Reference-FMUs . The FMU also correctly works in FMPy https://github.com/CATIA-Systems/FMPy . The FMU also passes the validation check here: https://fmu-check.herokuapp.com/ . However, when we try in Simulink, the simulation stays stuck on t=0.0, i.e. the start. We have added logs to the FMU and are able to see which statement the execution is stuck on, though, the reason for that is not clear.
To solve this, we would like to try to debug by placing breakpoints and view the value of the local variables etc. When trying to use the fmudialog.compileFMUSources we get a few compile errors. How can one better control the exact compile command that is used by compileFMUSources? The FMU depends on third-party libraries that needs to be correctly linked, hence having access to compile command would be helpful. Is there a way to pass the Makefile or CMakeLists to aid with the FMU building? Is there a way to avoid re-compilation since it was recently compiled with MSVC?
Attaching an empty FMU for context here. This is "empty" as in it does include the any numerical processing but includes the FMU piping, stepping, output passing, logging, a third party dependency - curl and CMakeLists as we use it, a README with build instructions. (`python build/build.py x86_64-windows`). Also, includes the resulting FMU in the build folder.
4 Comments
Christian Bertsch
on 16 Jun 2024
@Chintan: The FMU can still be standard-compliant. It does not have to be generated by a tool. Using the checkers as a good indication, especially for the validity of the modelDescription.xml.
Importing your FMU with FMIKit in Simulink could be an option. Even though FMIKit states ML/SL Support until 2023a, to my experience this works also in newer versions.
Regarding the native FMU import in ML/SL and recompilation with debug information: I am not sure, whether fmudialog.compileFMUSources considers the Build Confguration that you could provide with your FMU: https://fmi-standard.org/docs/3.0.1/#BuildConfiguration, where you could pass compiler options.
Answers (0)
See Also
Categories
Find more on Deploy Standalone Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!