Documentation

relationalboundaryinfo

Retrieve relational boundary coverage from cvdata object

Syntax

coverage = relationalboundaryinfo(covdata, object)
coverage = relationalboundaryinfo(covdata, object,mode)
coverage = relationalboundaryinfo(covdata, object, ignore_descendants)
[coverage, description] = relationalboundaryinfo(covdata, object)

Description

example

coverage = relationalboundaryinfo(covdata, object) returns relational boundary coverage results from the cvdata object covdata for the model object specified by object and its descendants.

example

coverage = relationalboundaryinfo(covdata, object,mode) returns relational boundary coverage results from the cvdata object covdata for the model object specified by object and its descendants for the simulation mode mode.

coverage = relationalboundaryinfo(covdata, object, ignore_descendants) returns relational boundary coverage results from the cvdata object covdata for the model object specified by object and, depending on the value of ignore_descendants, descendant objects.

[coverage, description] = relationalboundaryinfo(covdata, object) returns relational boundary coverage results from the cvdata object covdata for the model object specified by object, and textual descriptions of each coverage outcome.

Examples

collapse all

This example shows how to collect relational boundary coverage information for a Saturation block in a model. For more information on blocks supported for relational boundary coverage, see Model Objects That Receive Coverage.

Open the slvnvdemo_cv_small_controller model. Create a model coverage test specification object for the model.

open_system('slvnvdemo_cv_small_controller');
testObj = cvtest('slvnvdemo_cv_small_controller');

In the model coverage test specification object, activate relational boundary coverage.

testObj.settings.relationalop = 1;

Simulate the model and collect coverage results in a cvdata object.

dataObj = cvsim(testObj);

Obtain relational boundary coverage results for the Saturation block in slvnvdemo_cv_small_controller. The coverage results are stored in a two-element vector of the form [covered_outcomes total_outcomes].

blockHandle = get_param('slvnvdemo_cv_small_controller/Saturation','Handle');;
[covResults, covDesc] = relationalboundaryinfo(dataObj, blockHandle)
covResults =

     2     4


covDesc = 

    isFiltered: 0
      decision: [1x2 struct]

The field decision is a 1 X 2 structure. Each element of decision corresponds to a relational operation in the block. The Saturation block contains two comparisons. The first comparison is with a lower limit and the second with an upper limit. Therefore, decision is a 2-element structure.

View the first operation in the block that receives relational boundary coverage. For the Saturation block, the first relational operation is input > lowerlimit.

covDesc.decision(1)
ans = 

            outcome: [1x2 struct]
               text: 'input - lowerlimit'
         isFiltered: 0
    filterRationale: ''

The text field shows the two operands. The isFiltered field is set to 1 if the block is filtered from relational boundary coverage. For more information, see Coverage Filtering.

View results for the first relational operation in the block.

for(i=1:2)
  covDesc.decision(1).outcome(i)
end
ans = 

     isActive: 1
    execCount: 0
         text: '[-tol..0]'


ans = 

     isActive: 1
    execCount: 0
         text: '(0..tol]'

View the second operation in the block that receives relational boundary coverage. For the Saturation block, the second relational operation is input < upperlimit.

covDesc.decision(2)
ans = 

            outcome: [1x2 struct]
               text: 'input - upperlimit'
         isFiltered: 0
    filterRationale: ''

View results for the second relational operation in the block.

for(i=1:2)
  covDesc.decision(2).outcome(i)
end
ans = 

     isActive: 1
    execCount: 1
         text: '[-tol..0)'


ans = 

     isActive: 1
    execCount: 2
         text: '[0..tol]'

Input Arguments

collapse all

Coverage results data, specified as a cvdata object.

Model or model component, specified as a full path, handle, or array of paths or handles.

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 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 atomic 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.

Example: get_param('slvnvdemo_cv_small_controller/Saturation', 'Handle')

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.

Preference to ignore coverage of descendant objects, specified as a logical value.

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

Data Types: logical

Output Arguments

collapse all

Relational boundary coverage results, stored in a two-element vector of the form [covered_outcomes total_outcomes]. The two elements are:

covered_outcomesNumber of relational boundary outcomes satisfied for object
total_outcomesTotal number of relational boundary outcomes for object

Data Types: double

Textual description of coverage outcomes for the model component specified by object, returned as a structure array. Depending on the types of model coverage collected, the structure array can have different fields. If only relational boundary coverage is collected, the structure array contains the following fields:

isFiltered

0 if the model component specified by object is not excluded from coverage recording. 1 if the model component specified by object is excluded from coverage recording. For more information about excluding objects from coverage, see Coverage Filtering.

decision.text

Character vector of the form:

op_1-op_2

  • op_1 is the left operand in the relational operation.

  • op_2 is the right operand in the relational operation.

decision.outcome

Structure array containing two fields for each coverage outcome:

isActiveBoolean variable. If this variable is false, it indicates that decisions were not evaluated during simulation due to variable signal size.
execCountNumber of times op_1-op_2 fell in the range described by text
textThe range around the relational boundary considered for coverage. For more information, see Relational Boundary.

decision.isFiltered

0 if the model component specified by object is not excluded from coverage recording. 1 if the model component specified by object is excluded from coverage recording. For more information about excluding objects from coverage, see Coverage Filtering.

decision.filterRationale

Rationale for filtering the model component specified by object, if object is excluded from coverage and a rationale is specified. For more information about excluding objects from coverage, see Coverage Filtering.

Data Types: struct

Introduced in R2014b

Was this topic helpful?