Main Content

SIL/PIL Manager

Verify generated code

Description

The SIL/PIL Manager simplifies verification of code that you generate from a model.

You can:

  • With one click, test numeric equivalence between the model and generated code by running back-to-back model simulations and software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulations.

  • Configure SIL or PIL simulations to produce code coverage and execution-time profiling metrics.

  • Enable your debugger for SIL simulations.

  • Export automatically generated test cases for Simulink® Test™.

SIL/PIL Manager app

Open the SIL/PIL Manager App

On the Simulink toolstrip Apps tab, click SIL/PIL Manager. Or, on the Embedded Coder app C Code tab, click Verify Code > SIL/PIL Manager.

Examples

Verify Top-Model Code with a Single Click

  1. In the Command Window, enter rtwdemo_sil_topmodel.

  2. To open the SIL/PIL Manager, on the Apps tab, click SIL/PIL Manager.

  3. On the SIL/PIL tab, use the supplied settings.

  4. In the Run Automated Verification section, click Run Verification.

    The SIL/PIL Manager runs these simulations back-to-back:

    • rtwdemo_sil_topmodel in normal mode

    • rtwdemo_sil_topmodel in SIL mode. As the Coverage Collection and Profile Code controls are enabled, the SIL simulation also performs code coverage analysis and code execution profiling. For code coverage, you require Simulink Coverage™.

    You can monitor simulation progress through the Diagnostic Viewer.

    At the end of the second simulation:

    • The Simulation Data Inspector compares results from the model against results from generated code.

    • To view execution-time metrics, in the model view, click the blue region.

    • The Simulink Editor displays the Coverage tab. To display code coverage analysis results, in the Review Results section, click Coverage Details. To view coverage metrics for a specific block, in the model view, click the block, which is colored red.

Export Numeric Equivalence Test Case for Simulink Test

If you have Simulink Test, you can export a numeric equivalence test case:

  1. In the Command Window, enter rtwdemo_sil_modelblock.

  2. To open the SIL/PIL Manager, on the Apps tab, click SIL/PIL Manager.

  3. On the SIL/PIL tab, use the supplied settings.

  4. Open the Results gallery. In the Results section, click either Compare Runs or Data Inspector.

  5. Under Simulink Test, click Export to Test Manager.

  6. In the Export SIL/PIL Test Cases dialog box, use the default settings, and click OK.

The SIL/PIL Manager:

  • Creates the test case in rtwdemo_sil_topmodel_TestFile.mldatx, which you can find in the current working folder.

  • Opens the test file that contains the test case.

    For information about running test cases in Simulink Test, see Import Test Cases for Equivalence Testing (Simulink Test).

Related Examples

Introduced in R2019b