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.
In the model coverage test specification object, activate
relational boundary coverage.
Simulate the model and collect coverage results in a cvdata
object.
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]
.
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
.
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.
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
.
ans =
outcome: [1x2 struct]
text: 'input - upperlimit'
isFiltered: 0
filterRationale: ''
View results for the second relational operation in the
block.
ans =
isActive: 1
execCount: 1
text: '[-tol..0)'
ans =
isActive: 1
execCount: 2
text: '[0..tol]'