decisioninfo

Retrieve decision coverage information from cvdata object

Syntax

coverage = decisioninfo(cvdo, object)
coverage = decisioninfo(cvdo, object, mode)
coverage = decisioninfo(cvdo, object, ignore_descendants)
[coverage, description] = decisioninfo(cvdo, object)

Description

coverage = decisioninfo(cvdo, object) returns decision coverage results from the cvdata object cvdo for the model component specified by object.

coverage = decisioninfo(cvdo, object, mode) returns decision coverage results from the cvdata object cvdo for the model component specified by object for the simulation mode mode.

coverage = decisioninfo(cvdo, object, ignore_descendants) returns decision coverage results for object, depending on the value of ignore_descendants.

[coverage, description] = decisioninfo(cvdo, object) returns decision coverage results and text descriptions of decision points associated with object.

Input Arguments

cvdo

cvdata object

object

The object argument specifies an object in the model or Stateflow® chart that received decision coverage. Valid values for object include the following:

Object SpecificationDescription

BlockPath

Full path to a model or block

BlockHandle

Handle to a model or block

slObj

Handle to a Simulink® API object

sfID

Stateflow ID

sfObj

Handle to a Stateflow API object from a singly instantiated Stateflow chart

{BlockPath, sfID}

Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

{BlockPath, sfObj}

Cell array with the path to a Stateflow chart or subchart and a Stateflow object API handle contained in that chart or subchart

{BlockHandle, sfID}

Cell array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

When specifying an S-function block, valid values for object include the following:

Object SpecificationDescription

{BlockPath, fName}

Cell array with the path to an S-Function block and the name of a source file.

{BlockHandle, fName}

Cell array with an S-Function block handle and the name of a source file.

{BlockPath, fName, funName}

Cell array with the path to an S-Function block, the name of a source file, and a function name.

{BlockHandle, fName, funName}

Cell array with an S-Function block handle, the name of a source file an a function name.

For coverage data collected during Software-in-the-Loop (SIL) mode or Processor-in-the-Loop (PIL) simulation mode, valid values for object include the following:

Object SpecificationDescription

{fileName, funName}

Cell array with the name of a source file and a function name.

{Model, fileName}

Cell array with a model name (or model handle) and the name of a source file.

{Model, fileName, funName}

Cell array with a model name (or model handle), the name of a source file, and a function name.

mode

The mode argument specifies the simulation mode for coverage. Valid values for mode include the following:

Object SpecificationDescription

'Normal'

Model in Normal simulation mode.

'SIL' (or 'PIL')

Model in Software-in-the-Loop (SIL) or Processor-in-the-Loop (PIL) simulation mode.

'ModelRefSIL' (or 'ModelRefPIL')

Model reference in Software-in-the-Loop (SIL) or Processor-in-the-Loop (PIL) simulation mode.

'ModelRefTopSIL' (or 'ModelRefTopPIL')

Model reference in Software-in-the-Loop (SIL or Processor-in-the-Loop (PIL) simulation mode with code interface set to top model.

ignore_descendants

Specifies to ignore the coverage of descendant objects if ignore_descendants is set to 1.

Output Arguments

coverage

The value of coverage is a two-element vector of the form [covered_outcomes total_outcomes].coverage is empty if cvdo does not contain decision coverage results for object. The two elements are:

covered_outcomesNumber of decision outcomes satisfied for object
total_outcomesNumber of decision outcomes for object

description

description is a structure array containing the following fields:

textDescription of the decision measured
decisionStructure array describing individual decisions, including filtering information. decision.outcome is a structure array describing individual decision outcomes, including filtering information for outcomes
isFilteredWhether the block is filtered
filterRationaleThe filtering rationale
justifiedCoverageThe justified decision conditions
isJustifiedWhether the block is justified

Examples

Open the slvnvdemo_cv_small_controller model and create the test specification object testObj. Enable decision coverage for slvnvdemo_cv_small_controller and execute testObj using cvsim. Use decisioninfo to retrieve the decision coverage results for the Saturation block and determine the percentage of decision outcomes covered:

mdl = 'slvnvdemo_cv_small_controller';
open_system(mdl)
testObj = cvtest(mdl)
testObj.settings.decision = 1;
data = cvsim(testObj)
blk_handle = get_param([mdl, '/Saturation'], 'Handle');
cov = decisioninfo(data, blk_handle)
percent_cov = 100 * cov(1) / cov(2)

Alternatives

Use the coverage settings to collect and display decision coverage results:

  1. Open the model.

  2. In the Model Editor, select Model Settings on the Modeling tab.

  3. On the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.

  4. Under Coverage metrics, select Decision as the structural coverage level.

  5. Click OK to close the Configuration Parameters dialog box and save your changes.

  6. Simulate the model by clicking the Run button and review the results.

Introduced in R2006b