- Comment out or remove your S-Function block to determine if your s-function causes the hang.
- If it does, then you could try to use a Vis Studio debugger or gdebug to break in your mdlStart() function to take a look at what is happening. Sounds like a memory corruption issue. https://www.mathworks.com/help/simulink/sfg/debugging-c-mex-s-functions.html
Simulink intermittently hangs after return from mdlStart() in call to external C++ sfunction
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm writing a C++ SFunction for use with Simulink. This SFunciton connects to an exteral code to handle electrical circuit simulation.
In a typical run from Simulink, the following routines are called without any errors being reported by simulink and the C++ SFunctcion works as expecte:
mdlInitializeSizes()
mdlInitializeSampleTimes()
mdlStart()
mdlOutputs()
mdlTerminate()
But sometimes after Simulink calls mdlStart() and exits that routine it never calls mdlOutputs() and Simulink doesn't make any simulation progress. It's just stuck at time=0.
I'm not sure how to debug this as it looks like Simulink is not in my code when it hangs. The only way to stop the simulation at this point is to kill the main MATLAB job with "kill -9 <PID>".
Any suggestions on how to debug this?
0 comentarios
Respuestas (1)
Mark McBroom
el 8 de Sept. de 2021
0 comentarios
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!