How to run SIL for an existing generated code?

12 次查看(过去 30 天)
I have a generated code from a Simulink model, and I need to run SIL for it without regenerating the code. It seems there are different approaches for this task, like legency_code, s-function builder, etc. I wonder what is the best and most automated approach to build a SIL block from an existing generated code with no need to configure the code interface from my side? Since it is a generated code by MATLAB and not handwritten custom code, I think there should be an approach that the interface and other configurations should be identified by MATLAB automatically to build a new SIL block. Thanks

回答(1 个)

Aabha
Aabha 2025-2-27
To run a Software-in-the-Loop (SIL) simulation using existing generated code from a Simulink model without regenerating the code, the SIL/PIL Manager App can be used, from the Simulink toolstrip. Ensure that you have Embedded Coder installed, as it provides the necessary tools for SIL Simulation. The SIL block can be generated using the following steps:
  1. Open the SIL/PIL Manager by navigating to Apps > SIL/PIL Manager in Simulink.
  2. Choose SIL Simulation as the verification mode.
  3. In the “MODE” option, in the top left corner, select “SIL/PIL Simulation Only”. This option runs the generated code using SIL/PIL.
  4. Click on “Run Verification” to run the SIL simulation.
This method will configure the model automatically for SIL simulation. Please note that, the code will need to be regenerated every time the model is modified, or the compilation is out-of-date, which can be observed in the diagnostic viewer. Please refer to the below documentation links for more information on the SIL workflow:
I hope this answers the question.

类别

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