Main Content

relationalboundaryinfo

Retrieve relational boundary coverage from cvdata object

Description

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

example

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

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

[covInfo,description] = relationalboundaryinfo(cvdo,modelObject) returns relational boundary coverage results from the cvdata object cvdo for the model object specified by modelObject, 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 data, specified as a cvdata object.

Data Types: cvdata

Model object, specified as a character array, string array, Simulink handle, Stateflow ID, or cell array.

To specify a model object, such as a block or a Stateflow chart, use one of these formats:

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

To specify an S-Function block or its contents, use one of these formats:

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, and a function name

To specify a code coverage result, such as coverage data collected during software-in-the-loop (SIL) or processor-in-the-loop (PIL) analysis, use one of these formats:

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

Data Types: char | string | cell | Stateflow.State | Stateflow.Transition

Simulation mode during coverage analysis, specified as one of these options:

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 SIL or PIL simulation mode.

"ModelRefTopSIL" or "ModelRefTopPIL"

Model reference in SIL or PIL simulation mode with the code interface set to top model.

Data Types: char | string

Whether to ignore descendants in coverage results, specified as a numeric or logical 1 (true) or 0 (false), where:

  • 0 (false) includes coverage results of descendant objects.

  • 1 (true) ignores coverage results of descendant objects.

Data Types: single | double | logical

Output Arguments

collapse all

Coverage information, returned as a two-element array of the form [covered_outcomes, total_outcomes] if cvdo contains relational boundary coverage data, or an empty array if it does not.

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 or string 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

Version History

Introduced in R2014b