| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| R2010b Documentation → SystemTest |
| Contents | Index |
| Learn more about SystemTest |
The model coverage feature provided by the Simulink Verification and Validation software allows you to control the generation of coverage metrics for a Simulink model from within your SystemTest test. Model coverage metrics allow you to validate your model by identifying unexecuted subsystems, unselected switch positions, or untaken conditional transition paths. You can generate a cumulative coverage report, specify individual coverage options, or inherit a model's coverage settings.
Note To use the model coverage feature, you need a license for Simulink Verification and Validation. |
The following basic steps describe the typical work flow to use this feature:
Use an existing Simulink element or add one by clicking the New > Test Element button and selecting Simulink.
On the Properties pane, browse for your Simulink model using the browse button next to the Simulink model field.
To see an example, you can run the Signal Builder demo by typing systemtest demosystest_sigblder in MATLAB.
Configure the Simulink element as described in this chapter, using the Mappings tab of the Properties pane to define model overrides and map Simulink data to test variables.
On the Model Coverage tab, which appears if you have a license for the Simulink Verification and Validation software, select the Enable model coverage check box. The following figure shows the Signal Builder demo.

If you want to use the model coverage settings you already have on the Simulink model, select the Inherit coverage metric settings from the model option. Then go to step 12.
When you use this option, if the settings on the model change, the inherited settings will also change.
If you want to override the existing settings, select the Override model coverage metric settings option.
These settings are independent of the model.
Select Coverage for this model: <modelname>.

Click the Select Subsystem button in the Overridden Coverage Metrics section to specify the root model of your coverage data. Make your selection in the System Selector dialog box and click OK.

If you have one or more referenced models and you want to gather coverage for them, select the Coverage for referenced models option.
Then click the Select Models button to select the referenced model(s) for coverage. Make your selection in the Select Models for Coverage Analysis dialog box and click OK.
Note that you can record coverage only for referenced models that operate in Normal mode. You cannot enable coverage for referenced models operating in Accelerated mode.
If you have External Embedded MATLAB® functions in your model that you want to test, select the Coverage for external Embedded MATLAB files option. This enables coverage for external Embedded MATLAB functions called from your model.
In the Coverage Metrics area, select the metrics you require. The selected metrics will be generated and shown in the coverage report.

Summary of coverage metrics:
Decision — analyzes elements that represent decision points in a model, such as a Switch block or Stateflow states.
Condition — analyzes blocks that output the logical combination of their inputs, such as the Logical Operator block, and Stateflow transitions.
MCDC — modified condition/decision coverage analysis extends the decision and condition coverage capabilities. It analyzes blocks that output the logical combination of their inputs and Stateflow transitions to determine the extent to which the test case tests the independence of logical block inputs and transition conditions.
Look-up Table — examines blocks, such as the Lookup Table block, that output information from inputs in a table of inputs and outputs, interpolating between or extrapolating from table entries. Lookup table coverage records the frequency that table lookups use each interpolation interval.
Signal Range — records the minimum and maximum signal values at each block in the model, as measured during simulation. Only blocks with output signals receive signal range coverage.
Signal Size — records the minimum, maximum, and allocated size for all variable-size signals in a model.
Simulink Design Verifier — collects model coverage data for some Simulink Design Verifier blocks.
Use the Map Coverage Data to SystemTest Variables field to map coverage metrics to test variables. Click New Mapping and select Full Coverage Instrumentation Path if you want coverage data below the root you specified under Coverage for this model, or select Select Path to Map if you want to pick an alternate coverage path, which must be within the coverage instrumentation path. If you select the latter, your Simulink model will open and you can select a block to specify an alternate root for your coverage path.
Select the Metric you want to map to a test variable, and specify the test variable to use under the SystemTest Data column.

Note that if you select <New Test Variable> in the SystemTest Data column, the default name will match the input. For example, if the model name is systemtestpendulum from the Coverage Path column, and the metric you select in the Metric column is MCDC Coverage then the default name for the new variable would be systemtestpendulum_mcdcinfo. The logical default name reflects the name of the model and the metric. You can use the default name or change it.
Run your test.
View the coverage report by clicking the link in the Run Status pane.

For more information on the model coverage feature, including details about the coverage metrics, see Using Model Coverage in the Simulink Verification and Validation documentation.

![]() | Overriding Inport Block Signals | Using Simulink Design Verifier Data Files in a Test | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |