Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Verification and Validation   

mcdcinfo - Collect modified condition/decision coverage information for model object

Syntax

coverage = mcdcinfo(cvdo, object)
coverage = mcdcinfo(cvdo, object, ignore_descendants)
[coverage, description] = mcdcinfo(cvdo, object)

Description

coverage = mcdcinfo(cvdo, object) returns modified condition/decision coverage (MC/DC) results from the cvdata object cvdo for the model component specified by object.

coverage = mcdcinfo(cvdo, object, ignore_descendants) returns MC/DC results for object, depending on the value of ignore_descendants.

[coverage, description] = mcdcinfo(cvdo, object) returns MC/DC results and text descriptions of each condition/decision in object.

Inputs

cvdo

cvdata object

ignore_descendants

Logical value specifying whether to ignore the coverage of descendant objects

1 — Ignore coverage of descendant objects
0 — Collect coverage for descendant objects

object

The object argument specifies an object in the Simulink model or Stateflow diagram that receives 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

{BlockPath, sfID}

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

{BlockPath, sfObj}

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

[BlockHandle, sfID]

Array with a Stateflow chart handle and the ID of an object contained in that chart

Outputs

coverage

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

covered_outcomesNumber of condition/decision outcomes satisfied for object
total_outcomesTotal number of condition/decision outcomes for object

description

A structure array containing the following fields:

textString denoting whether the condition/decision is associated with a block output or Stateflow transition
condition.textString describing a condition/decision or the block port to which it applies
condition.achievedLogical array indicating whether a condition case has been fully covered
condition.trueRsltString representing a condition case expression that produces a true result
condition.falseRsltString representing a condition case expression that produces a false result

Examples

Collect MC/DC coverage for the slvnvdemo_cv_small_controller model and determine the percentage of MC/DC coverage collected for the Logic block in the Gain subsystem:

mdl = 'slvnvdemo_cv_small_controller';
open_system(mdl)
testObj = cvtest(mdl)                      %Create test specification object
testObj.settings.mcdc = 1;                 %Enable MC/DC coverage
data = cvsim(testObj)                      %Simulate model
blk_handle = get_param([mdl, '/Gain/Logic'], 'Handle');
cov = mcdcinfo(data, blk_handle)           %Retrieve MC/DC results for Logic block
percent_cov = 100 * cov(1) / cov(2)        %Percentage of MC/DC outcomes covered 

Alternatives

To collect MC/DC coverage for a model:

  1. Open the model.

  2. In the Model Editor, select Tools > Coverage Settings.

  3. On the Coverage tab, under Coverage Metrics, select MCDC Coverage.

  4. On the Results and Report tabs, select the desired options.

  5. Click OK to close the Coverage Settings dialog box.

  6. Simulate the model and review the MC/DC coverage in the report.

See Also

conditioninfo | cvsim | decisioninfo | sigrangeinfo | tableinfo

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS