User`s guide
Run Tests with cvsim
21-5
Run Tests with cvsim
Use the cvsim command to simulate a test specification object.
The call to cvsim has the following default syntax:
cvdo = cvsim(cvto)
This command executes the cvtest object cvto by simulating the corresponding model.
cvsim returns the coverage results in the cvdata object cvdo. When recording coverage
for multiple models in a hierarchy, cvsim returns its results in a cv.cvdatagroup
object.
You can also control the simulation in a cvsim command by setting model parameters for
the Simulink sim command to apply during simulation:
• The following command executes the test object cvto and simulates the model
using the default model parameters. The cvsim function returns the coverage
results in the cvdata object cvdo and returns the simulation outputs in a
Simulink.SimulationOutput class object simOut:
[cvdo,simOut] = cvsim(cvto)
• The following commands create a structure, paramStruct, that specifies the model
parameters to use during the simulation. The first command specifies that the
simulation collect decision, condition, and MCDC coverage for this model.
paramStruct.CovMetricSettings = 'dcm';
paramStruct.SimulationMode = 'rapid';
paramStruct.AbsTol = '1e-5';
paramStruct.SaveState = 'on';
paramStruct.StateSaveName = 'xoutNew';
paramStruct.SaveOutput = 'on';
paramStruct.OutputSaveName = 'youtNew';
Note: For a complete list of model parameters, see “Model Parameters” in the
Simulink documentation.
The following cvsim command executes the test object cvto and simulates the model
using the model parameter values specified in paramStruct:
[cvdo,simOut] = cvsim(cvto,paramStruct);