SIL/PIL Manager Verification Workflow
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 Verify Code > SIL/PIL Manager.
Select the Mode
In the Mode section, specify the simulations that you want the app to run. You can select:
Automated Verification –– The app runs two simulations back-to-back. The first simulation is a model simulation in normal, accelerator, or rapid accelerator mode. The second simulation is a software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation. After the second simulation is complete, the app uses the Simulation Data Inspector to compare the results of the simulations.
For the first simulation, if the model contains a Model block with the Simulation mode block parameter set to
Software-in-the-loop (SIL)
orProcessor-in-the-loop (PIL)
, at the start of the simulation, the app changes the block parameter toNormal
. At the end of the simulation, the app reverts the block parameter to the previous value.Simulation Only –– The app runs a model simulation in normal, accelerator, or rapid accelerator mode.
If the model contains a Model block with the Simulation mode block parameter set to
Software-in-the-loop (SIL)
orProcessor-in-the-loop (PIL)
, at the start of the simulation, the app changes the block parameter toNormal
. At the end of the simulation, the app reverts the block parameter to the previous value.SIL/PIL Simulation Only –– The app runs a SIL or PIL simulation.
Prepare the Model
In the Prepare section:
Specify the numeric testing approach.
Specify the main configuration parameters.
Enable or disable code execution profiling and code coverage analysis.
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 —
Simulation
Mode — SIL/PIL
Mode — | Top model simulation mode specified by Simulation Mode setting. Model blocks in SIL or PIL mode are set to normal mode. | Top model simulation mode specified by SIL/PIL Mode setting. Model blocks use specified simulation modes. |
Model block | System Under Test — Model blocks in SIL/PIL mode Top Model Mode —
| 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 harness The app supports test harnesses that you create from models and Model 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 — SIL/PIL
Mode — | Harness model in normal mode. Model block mode for harness owner specified by Simulation Mode setting. Internal Model 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:
Under SIL/PIL Settings:
Settings — Display Verification parameters in the Configuration Parameters dialog box.
Portable Word Sizes — Select or clear Enable portable word sizes. For information about how you can generate code that supports compilation on your development computer, see Configure Hardware Implementation Settings.
Debugging — Select or clear Enable source-level debugging for SIL or PIL.
Under Coverage:
Coverage Settings — Display Coverage parameters in the Configuration Parameters dialog box.
Coverage Collection — Enable or disable code coverage. If code coverage with Simulink Coverage™ is enabled, clicking the button toggles
CovEnable
between'on'
and'off'
. For more information, see Code Coverage.
Under Time Profiling:
Task Profiling — Select or clear Measure task execution time.
Save Options — If Task Profiling is selected, clicking the button sets the Save options configuration parameter to
Summary data only
,All data
, andMetrics only
cyclically. If Task Profiling is not selected, the button is dimmed.Functions — Clicking the button sets the Measure function execution times configuration parameter to
Off
,Coarse (referenced models and subsystems only)
, andDetailed (all function call sites)
cyclically.
For more information, see Configure Code Execution Profiling and Control Profiling Granularity.
Under Stack Profiling, Stack Profiling— Select or clear Measure task stack usage. For more information, see View and Compare Stack Usage Metrics.
If you click Monitor Signals, the app provides these controls:
Under Monitor Signals:
Log Selected Signals — Enable signal logging for model simulation.
Make Selected Signals Testpoints — Required for signal observation in SIL or PIL simulations.
Under Logging Options:
Signal Logging — Set the
SignalLogging
configuration parameter to'on'
or'off'
, which enables or disables signal logging to the MATLAB® workspace and signal streaming to the Simulation Data Inspector.State Logging — Set the
SaveState
configuration parameter to'on'
or'off'
, which enables or disables state data logging to the MATLAB workspace and state data streaming to the Simulation Data Inspector.Signal Table — Display the Signals tab in the Model Data Editor.
Configure Logging — Display the Data Import/Export parameters in the Configuration Parameters dialog box.
Normal Mode Visibility — Open the Model Block Normal Mode Visibility dialog box.
To monitor component signals and state data and compare values from the model and SIL or PIL simulations:
For each signal that you want to log:
In the Simulink Editor, select the signal.
On the SIL/PIL tab, click Monitor Signals. From the gallery, select these options:
Log Selected Signals
Make Selected Signals Testpoints
Signal Logging
To log state data, from the Monitor Signals gallery, select State Logging.
If the Language configuration parameter is
C++
, 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, the SIL/PIL tab displays the Run Automated Verification section. To run back-to-back simulations:
In the Stop Time field, specify the simulation time. For the Automated Verification mode, you cannot specify
inf
.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:
Fast Restart — Click to turn on fast restart. For the Simulation Only mode, the compiled model does not contain components in SIL or PIL mode.
Step Back and Step Forward — You can configure stepping through a simulation by using the Simulation Stepping Options tool. To open the tool, click Step Back, and then select Configure Simulation Stepping.
Simulation stepping is not available if the mode is SIL/PIL Simulation Only and System Under Test is
Top model
.
To run an individual simulation:
In the Stop Time field, specify the simulation time.
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:
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.
For information about using exported test cases, see Import Test Cases for Equivalence Testing (Simulink Test). |