cvdata - Access Simulink
Coverage data in the MATLAB workspace - MATLAB ([original](https://in.mathworks.com/help/slcoverage/ref/cvdata.html)) ([raw](?raw))
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. Thecvdata
object becomes invalid if you close or modify its parent model.
Properties
This property is read-only.
Coverage data origin release, returned as a character array.
Data Types: char
This property is read-only.
Internal coverage data ID, returned as a scalar.
Data Types: double
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
This property is read-only.
Test data, returned as a cvtest
object. This property describes the coverage configuration.
Data Types: cvtest
This property is read-only.
Internal root ID, returned as a scalar.
Data Types: double
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
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 |
---|---|---|
modelVersion | Version of the model analyzed for coverage. | character array containing version number |
creator | Original creator of the model. | System name or organization name |
lastModifiedDate | Date and time the model was last modified. | character array containing date and time |
defaultParameterBehavior | Indicates the default parameter behavior setting. | 'Tunable' | 'Inlined' |
blockReductionStatus | Indicates whether Block Reduction is enabled.See Block Reduction for more information. | 'off' | 'on' |
conditionallyExecuteInputs | Conditional input execution switch. A value of 1 is 'on', and a value of 0 is'off'. | 1 | 0 |
mdcdMode | Definition used for modified condition decision coverage (MCDC) analysis. A value of 1 indicates the model used the masking definition of MCDC and a value of 0 indicates the model used the unique-cause definition of MCDC.For more information, see Modified Condition and Decision Coverage (MCDC) Definitions in Simulink Coverage. | 1 | 0 |
analyzedModel | 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. | character array |
reducedBlocks | List of blocks reduced by the block reduction parameter, if it is enabled and any blocks are reduced. | character array |
ownerModel | 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 |
ownerBlock | If the model includes a subsystem harness, this is the subsystem that the harness is testing. | character array |
harnessModel | Harness model name. If you have data aggregated from multiple test runs, where each run used a different harness with the sameownerModel, this field shows Not Unique. | character array |
logicBlkShortcircuit | Indicates whether the short-circuiting option is enabled. | 0 | 1 |
Data Types: struct
System time at simulation start, returned as a character array.
Data Types: char
System time at simulation stop, returned as a character array.
Data Types: char
Coverage interval start time, returned as a scalar. This value comes from theCovStartTime
parameter. For more information, see Coverage interval start time.
Data Types: double
Coverage interval stop time, returned as a scalar. This value comes from theCovStopTime
parameter. For more information, see Coverage interval stop time.
Data Types: double
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
Simulation mode, returned as a character array. For more information, see Simulation mode.
Data Types: char
Whether to exclude inactive variants in coverage report, specified as0
or 1
. Set this property to0
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 aggregatedcvdata
object has an excludeInactiveVariants
property value of 0
.
Example: covData.excludeInactiveVariants = 1;
Data Types: double
Object Functions
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 | 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 fromcvdata 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 cvdata objects. The returnedcvdata object contains the total aggregated coverage for two simulations or tests. |
---|---|
- | Returns the set difference between the left and right operands. The returned cvdata object contains the coverage objective outcomes that are satisfied by the left operand but not the right operand. Use- to determine how much additional coverage is attributed to a specific simulation or test. |
* and .* | Returns the intersection between two cvdata objects. The returned cvdata object contains only the coverage satisfied by both operands. Use * to detect overlapping coverage between two simulations or tests. |
Examples
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
.
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)
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)
Version History
Introduced before R2006a