SIL/PIL Manager Verification Workflow - MATLAB & Simulink (original) (raw)

Main Content

The SIL/PIL Manager is an app that provides a simplified workflow for verifying generated model code.

Open the App

To open the SIL/PIL Manager in the Simulink® Editor, on the Apps tab, click SIL/PIL Manager. Or, on the C Code tab in the Embedded Coder® app, select > .

Select the Mode

In the Mode section, specify the simulations that you want the app to run. You can select:

Prepare the Model

In the Prepare section:

This table shows how the field settings in the Prepare section control simulations that the app runs.

Workflow Field Settings Model Simulation SIL or PIL Simulation
Top model System Under Test —Top modelSimulation Mode — Normal,Accelerator, orRapid AcceleratorSIL/PIL Mode — Software-in-the-Loop (SIL) orProcessor-in-the-Loop (PIL) Top model simulation mode specified bySimulation Mode setting.Model blocks in SIL or PIL mode are set to normal mode. Top model simulation mode specified bySIL/PIL Mode setting.Model blocks use specified simulation modes.
Model block System Under Test —Model blocks in SIL/PIL modeTop Model Mode —Normal orAccelerator Top model simulation mode specified by Top Model Mode setting.Model blocks in SIL or PIL mode are set to normal mode. Top model simulation mode specified by Top Model Mode setting.Model blocks use specified simulation modes.
Test harnessThe app supports test harnesses that you create from models andModel blocks. For information about creating test harnesses, see Create or Import Test Harnesses and Select Properties (Simulink Test). System Under Test — Harness owner. Not editable.Simulation Mode — Normal,Accelerator, orRapid AcceleratorSIL/PIL Mode — Software-in-the-Loop (SIL) orProcessor-in-the-Loop (PIL) Harness model in normal mode.Model block mode for harness owner specified by Simulation Mode setting.InternalModel blocks of harness owner in SIL or PIL mode set to normal mode. Harness model in normal mode.Model block for harness owner specified by SIL/PIL Mode setting.Internal Model blocks of harness owner use specified simulation modes.

If you click Settings, the app provides these controls:

If you click Monitor Signals, the app provides these controls:

To monitor component signals and state data and compare values from the model and SIL or PIL simulations:

  1. For each signal that you want to log:
    1. In the Simulink Editor, select the signal.
    2. On the SIL/PIL tab, clickMonitor Signals. From the gallery, select these options:
      • Log Selected Signals
      • Make Selected Signals Testpoints
      • Signal Logging
  2. To log state data, from the Monitor Signals gallery, select State Logging.
  3. If the Language configuration parameter isC++, in the Code Mappings editor, set the Data Visibility for the signals, states, and internal data model element categories topublic.

For more information, see Log Signals of a Component.

Run Automated Verification, Model Simulation, or SIL/PIL Simulation

With one click, you can run back-to-back model and SIL or PIL simulations. You can also run individual simulations.

If you select the Automated Verification mode, theSIL/PIL tab displays the Run Automated Verification section. To run back-to-back simulations:

  1. In the Stop Time field, specify the simulation time. For the Automated Verification mode, you cannot specify inf.
  2. Click Run Verification.

If you select the Simulation Only or SIL/PIL Simulation Only mode, the SIL/PIL tab displays the Run section. In this case, the toolstrip provides additional controls:

To run an individual simulation:

  1. In the Stop Time field, specify the simulation time.
  2. Click Run Simulation or Run SIL/PIL.

Analyze Results and Export Test Cases

In the app Results section, you can analyze results. If you click Compare Runs or Data Inspector, the app provides these controls in the Results gallery.

Section Control Description
Numerical Equivalence Results Compare Runs Compare results from the last model and SIL/PIL simulations by using the Simulation Data Inspector. Use the comparison to decide whether the results are numerically consistent.If the mode is Automated Verification, at the end of back-to-back simulations, the Simulation Data Inspector compares logged signals from the model and SIL or PIL simulations.
Data Inspector Open the Simulation Data Inspector.
Code Code View By default, at the end of SIL or PIL simulations, the SIL/PIL Manager displays the Code view, which enables you to: Analyze generated code.See code metrics.Trace between model elements and generated code.If the view is closed and you want to reopen it, click Code View.
Execution Profiling Results Highlight Profiling Highlight blocks profiled in the last SIL or PIL simulation.
Generate Report Open code execution profiling report for the last SIL or PIL simulation. For more information, see View and Compare Code Execution Times.
Generate Schedule In the Simulation Data Inspector, show task scheduling for the last SIL or PIL simulation. For more information, see Visualize Task Scheduling in SIL Simulation.
Stack Profiling Results Generate Report Open stack usage profiling report for the last SIL or PIL simulation. For more information, see View Stack Usage Metrics for Tasks and Functions.
Coverage Analysis Results(Controls available only if you have a Simulink Coverage license) Coverage Highlighting Highlight blocks that are analyzed for coverage and provide summary results.
Coverage Details Display the code coverage report in the Simulink Editor.
Results Explorer Open Results Explorer. For more information, see Access, Manage, and Aggregate Coverage Results (Simulink Coverage).
Generate Report Generate the code coverage report in a web browser.
Simulink Test Export to Test Manager If you have Simulink Test™, using the current app settings, you can create and export an equivalence test case. The test case enables you to run to back-to-back simulations and check whether model components and the generated code are numerically equivalent.Click Export to Test Manager.In the Export SIL/PIL Test Cases dialog box: Click Use a new test file or Reuse an existing file.In the Test file field, specify the name of the test file. By default, the dialog box specifies:currentWorkingFolderPath_\_modelName_Testfile.mldatxIf the test file exists and you clickUse a new test file, the app overwrites the existing file. If you clickReuse an existing file, the app adds the test case to the existing file.Click OK. The app creates an equivalence test case in the specified test file.For information about using exported test cases, see Import Test Cases for Equivalence Testing (Simulink Test).

See Also

SIL/PIL Manager

Topics