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金宝app®Test™.

Open the SIL/PIL Manager App

On the Simulink toolstripAppstab, clickSIL/PIL Manager. Or, on the Embedded Coder appC Codetab, clickVerify Code>SIL/PIL Manager.

Examples

Verify Top-Model Code with a Single Click

  1. In the Command Window, enterrtwdemo_sil_topmodel.

  2. To open the SIL/PIL Manager, on theAppstab, clickSIL/PIL Manager.

  3. On theSIL/PILtab, use the supplied settings.

  4. In theRun Automated Verification部分中,点击Run Verification.

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

    • rtwdemo_sil_topmodelin normal mode

    • rtwdemo_sil_topmodelin SIL mode. As theCoverage CollectionandProfile Codecontrols are enabled, the SIL simulation also performs code coverage analysis and code execution profiling. For code coverage, you requireSimulink 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 theCoveragetab. To display code coverage analysis results, in theReview Results部分中,点击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金宝appTest

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

  1. In the Command Window, enterrtwdemo_sil_modelblock.

  2. To open the SIL/PIL Manager, on theAppstab, clickSIL/PIL Manager.

  3. On theSIL/PILtab, use the supplied settings.

  4. Open theResultsgallery. In theResults部分中,点击eitherCompare RunsorData Inspector.

  5. UnderSimulink Test, clickExport to Test Manager.

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

The SIL/PIL Manager:

  • Creates the test case inrtwdemo_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 inSimulink Test, seeImport Test Cases for Equivalence Testing(Simulink Test).

Related Examples

Introduced in R2019b