Simulink model -Code generation

3 次查看(过去 30 天)
Hello
I am currently trying to generate C++ code from a Simulink model (code only for grt.tlc system target file). The model includes some s-functions in which the mdlstart() functions are waiting for outside signal (TCP connexion).
I can't send those signal during code generation. However, the code generation phases includes build and initialization steps. So then, initialization triggers mdlstart functions in s-function blocks.
Is there a way to avoid this intialization step during code generation (options in configuration parameters window)?
Thank you

回答(1 个)

Akshat Dalal
Akshat Dalal 2024-8-16
Hi Jerome,
One way to achieve this is to use the “ssRTWGenIsCodeGen” function. This function detects whether the S-Function is being used for standalone code generation.
You can modify your mdlStart() function to check whether it is being executed during code generation or during normal execution. This can be done by using the “ssRTWGenIsCodeGen” function, which returns true if the model is being compiled for code generation.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by