cvdata
Access Simulink Coverage data in the MATLAB workspace
Description
cvdata
objects store model coverage data.
Creation
A cvdata
object is generated automatically when you simulate a model that
has coverage enabled. You can access the coverage data by using coverage functions. The
cvdata
object becomes invalid if you close or modify its parent
model.
Properties
dbVersion
— Coverage data origin release
character array
This property is read-only.
Coverage data origin release, returned as a character array.
Data Types: char
id
— Internal coverage data ID
scalar
This property is read-only.
Internal coverage data ID, returned as a scalar.
Data Types: double
type
— Internal coverage data type
TEST_DATA
| DERIVED_DATA
This property is read-only.
Internal coverage type, returned as either TEST_DATA
for a single
coverage simulation, or DERIVED_DATA
for aggregated or cumulative
coverage data.
Data Types: char
test
— Test data
cvtest
object
This property is read-only.
Test data, returned as a cvtest
object. This property describes the
coverage configuration.
Data Types: cvtest
rootID
— Internal root ID
scalar
This property is read-only.
Internal root ID, returned as a scalar.
Data Types: double
checksum
— Coverage data checksum
struct
This property is read-only.
Coverage data checksum, returned as a structure array. Some changes to the model
cause the checksum
to change, for example, editing the model
structure like removing or adding blocks, or changing some configuration parameters. To
aggregate coverage results, the cvdata.checksum
properties must
match.
Data Types: struct
modelinfo
— Model information
struct
This property is read-only.
Model information, returned as a structure array. This property contains metadata about the model analyzed for coverage.
cvdata.modelinfo
has the following fields:
Field | Description | Values |
---|---|---|
| Version of the model analyzed for coverage. |
|
| Original creator of the model. | System name or organization name |
| Date and time the model was last modified. |
|
| Indicates the default parameter behavior setting. |
|
| Indicates whether Block Reduction is enabled. See Block Reduction for more information. |
|
| Conditional input execution switch. A value of |
|
| Definition used for modified condition decision coverage (MCDC)
analysis. A value of For more information, see Modified Condition and Decision Coverage (MCDC) Definitions in Simulink Coverage. |
|
| Name of the analyzed model or model object. If analysis is scoped to a subsystem, Stateflow® Chart, or other model object, this is the path to that model object. |
|
| List of blocks reduced by the block reduction parameter, if it is enabled and any blocks are reduced. |
|
| Model that is or contains the component under test. If you have a block diagram harness, this is the model that the harness tests. If you have a subsystem harness, this is the model that contains that subsystem. | character array |
| If the model includes a subsystem harness, this is the subsystem that the harness is testing. |
|
| Harness model name. If you have data aggregated from multiple test
runs, where each run used a different harness with the same
| character array |
| Indicates whether the short-circuiting option is enabled. |
|
Data Types: struct
startTime
— System time at simulation start
character array
System time at simulation start, returned as a character array.
Data Types: char
stopTime
— System time at simulation stop
scalar
System time at simulation stop, returned as a character array.
Data Types: char
intervalStartTime
— Coverage interval start time
scalar
Coverage interval start time, returned as a scalar. This value comes from the
CovStartTime
parameter. For more information, see Coverage interval start time.
Data Types: double
intervalStopTime
— Coverage interval stop time
scalar
Coverage interval stop time, returned as a scalar. This value comes from the
CovStopTime
parameter. For more information, see Coverage interval stop time.
Data Types: double
filter
— Coverage filter file name
character array
| cell array
Coverage filter file name, returned as a character array or a cell array of character arrays. This property contains the coverage filter file name. If a coverage filter is not applied, this field is empty. You can apply a coverage filter after simulation by assigning the name of a valid filter file to this property.
Data Types: char
| cell
simMode
— Simulation mode
character array
Simulation mode, returned as a character array. For more information, see Simulation mode.
Data Types: char
excludeInactiveVariants
— Whether to exclude inactive variants in coverage report
0
(default) | 1
Whether to exclude inactive variants in coverage report, specified as
0
or 1
. Set this property to
0
to report inactive variants in the coverage report, and set this
property to 1
to exclude inactive variants from the coverage
report.
This property affects only Simulink® variants with startup activation time and inactive variant configurations in Stateflow charts.
If you aggregate two or more cvdata
objects with different values
of excludeInactiveVariants
, the resulting aggregated
cvdata
object has an excludeInactiveVariants
property value of 0
.
Example: covData.excludeInactiveVariants = 1;
Data Types: double
Object Functions
View and Save Coverage Results
cvhtml | Create HTML coverage report from model coverage objects |
cvmodelview | Display model coverage results with model highlighting |
cvresults | Returns active coverage data, clears and loads active coverage data from a file |
cvsave | Save coverage settings and results to file |
Extract Coverage Results from cvdata
Objects
extract | Extract subsystem coverage data from system-level coverage data |
complexityinfo | Retrieve cyclomatic complexity coverage information from cvdata
object |
conditioninfo | Retrieve condition coverage information from cvdata
object |
decisioninfo | Retrieve decision coverage information from cvdata
object |
executioninfo | Retrieve execution coverage information from cvdata
object |
getCoverageInfo | Retrieve coverage information for Simulink
Design Verifier blocks from cvdata object |
mcdcinfo | Retrieve modified condition/decision coverage information from
cvdata object |
overflowsaturationinfo | Retrieve saturation on integer overflow coverage from cvdata object |
relationalboundaryinfo | Retrieve relational boundary coverage from cvdata object |
sigrangeinfo | Retrieve signal range coverage
information from cvdata
object |
sigsizeinfo | Retrieve signal size coverage information from cvdata
object |
tableinfo | Retrieve lookup table coverage
information from cvdata
object |
You can use these specialized MATLAB® operators with cvdata
objects.
+ | Returns the union of two |
- | Returns the set difference between the left and right operands. The
returned |
* and .* | Returns the intersection between two |
Examples
View Decision Coverage Data
This example shows how to view decision coverage data for a block in your model.
Load the model.
modelName = 'slvnvdemo_cv_small_controller';
load_system(modelName);
Configure the coverage settings for the model by using a Simulink.SimulationInput
object.
simIn = Simulink.SimulationInput(modelName); simIn = setModelParameter(simIn,'CovEnable','on'); simIn = setModelParameter(simIn,'CovMetricStructuralLevel','Decision'); simIn = setModelParameter(simIn,'CovSaveSingleToWorkspaceVar','on'); simIn = setModelParameter(simIn,'CovSaveName','covData');
Simulate the model by passing simIn
as the input to sim
.
simOut = sim(simIn);
Extract the coverage data as a cvdata
object from the SimulationOutput
object, simOut
.
covData = simOut.covData;
View the decision coverage results for the Saturation block by calling decisioninfo
with the block path.
blockPath = [modelName,'/Saturation'];
decisionCov = decisioninfo(covData,blockPath)
decisionCov = 3 4
decisioninfo
returns an array with two scalars. The first value is the number of satisfied decision outcomes, and the second value is the number of total decision outcomes. Use these to determine the percentage of satisfied decision outcomes for the Saturation block.
percentDecisionCov = 100 * decisionCov(1) / decisionCov(2)
percentDecisionCov = 75
Version History
Introduced before R2006a
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)