MATLAB: Is there a difference in code generation when running a SIL simulation with Model blocks in R2013a

Embedded Coder

When using a Model block for SIL simulation, the structure of generated code is different from that of code generated from referenced model with the standalone code interface.

Best Answer

This behavior is expected in R2013a because the code is generated from referenced model as part of a model reference hierarchy. Code generation uses the following command:
slbuild('model', 'ModelReferenceRTWTarget')
Starting from R2014b, there is a new setting option when you set the Simulation mode parameter to SIL (or PIL) for the model block, which allows specification of the code that you want to test.
<https://www.mathworks.com/help/releases/R2014b/ecoder/ug/referenced-model-simulation-using-sil-or-pil.html>
If you select "Top model" from the drop-down list, code will be generated from referenced model with the standalone code interface. In this case, the command
slbuild('model')
is used for code generation.