This example shows how to create and view cumulative coverage results for a model with a reusable subsystem.
Simulink® Coverage™ provides cumulative coverage for multiple instances of identically configured:
Reusable subsystems
Stateflow™ constructs
To obtain cumulative coverage, you add the individual coverage results at the command line. You can get cumulative coverage results for multiple instances across models and test harnesses by adding the individual coverage results.
At the MATLAB® command line, type:
model = 'slvnvdemo_cv_mutual_exclusion';
open_system(model);
This model has two instances of a reusable subsystem. The instances are named Subsystem 1 and Subsystem 2.
Execute the commands for Subsystem 1 decision coverage:
testobj1 = cvtest([model '/Subsystem 1']);
testobj1.settings.decision = 1;
covobj1 = cvsim(testobj1);
Execute the commands for Subsystem 2 decision coverage:
testobj2 = cvtest([model '/Subsystem 2']);
testobj2.settings.decision = 1;
covobj2 = cvsim(testobj2);
Execute the command to create cumulative decision coverage for Subsystem 1 and Subsystem 2:
covobj3 = covobj1 + covobj2;
Create an HTML report for Subsystem 1 decision coverage:
cvhtml('subsystem1',covobj1)
The report indicates that decision coverage is 50% for Subsystem 1. The true
condition for enable logical value
is not analyzed.
Create an HTML report for Subsystem 2 decision coverage:
cvhtml('subsystem2',covobj2)
The report indicates that decision coverage is 50% for Subsystem 2. The false
condition for enable logical value
is not analyzed.
Create an HTML report for cumulative decision coverage for Subsystem 1 and Subsystem 2:
cvhtml('cum_subsystem',covobj3)
Cumulative decision coverage for reusable subsystems Subsystem 1 and Subsystem 2 is 100%. Both the true
and false
conditions for enable logical value
are analyzed.