cvsim

Simulate and return model coverage results for test objects

Syntax

cvdo = cvsim(modelName)
cvdo = cvsim(cvto)
[cvdo,simOut] = cvsim(cvto,Name1,Value1,Name2,Value2,...)
[cvdo,simOut] = cvsim(cvto,ParameterStruct)
[cvdo1,cvdo2,...] = cvsim(cvto1,cvto2,...)

Description

cvdo = cvsim(modelName) simulates the model and returns the coverage results for the model. cvsim saves the coverage results in the cvdata object, cvdo. However, when recording coverage for multiple models in a hierarchy, cvsim returns the coverage results in a cv.cvdatagroup object.

cvdo = cvsim(cvto) simulates the model and returns the coverage results for the cvtest object, cvto. cvsim saves the coverage results in the cvdata object, cvdo. However, when recording coverage for multiple models in a hierarchy, cvsim returns the coverage results in a cv.cvdatagroup object.

[cvdo,simOut] = cvsim(cvto,Name1,Value1,Name2,Value2,...) specifies the model parameters and simulates the model. cvsim returns the coverage results in the cvdata object, cvdo, and returns the simulation outputs in the Simulink.SimulationOutput object, simOut.

[cvdo,simOut] = cvsim(cvto,ParameterStruct) sets the model parameters specified in a structure ParameterStruct, simulates the model, returns the coverage results in cvdo, and returns the simulation outputs in simOut.

[cvdo1,cvdo2,...] = cvsim(cvto1,cvto2,...) simulates the model and returns the coverage results for the test objects, cvto1, cvto2, .... cvdo1 contains the coverage results for cvto1, cvdo2 contains the coverage results for cvto2, and so on.

Note

Even if you have not enabled coverage recording for the model, you can execute the cvsim command to record coverage for your model.

Input Arguments

modelName

Name of model specified as a character vector or string

cvto

cvtest object that specifies coverage options for the simulation

ParameterStruct

Model parameters specified as a structure

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'ParameterName'

Name of the model parameter to be specified for simulation

'ParameterValue'

Value of the model parameter

Output Arguments

cvdo

cvdata object

simOut

A Simulink.SimulationOutput object that contains the simulation outputs.

Examples

Open the sldemo_engine example model, create the test object, set the model parameters, and simulate the model. cvsim returns the coverage data in cvdo and the simulation outputs in the Simulink.SimulationOutput object, simOut:

model = 'sldemo_engine'; 
open_system(model); 
testObj = cvtest(model);                    % Get test data
testObj.settings.decision = 1;
paramStruct.AbsTol            = '1e-5';
paramStruct.SaveState         = 'on';
paramStruct.StateSaveName     = 'xoutNew';
paramStruct.SaveOutput        = 'on';
paramStruct.OutputSaveName    = 'youtNew';
[cvdo,simOut] = cvsim(testObj,paramStruct); % Get coverage
cvhtml('CoverageReport.html', cvdo);        % Create HTML Report

Introduced before R2006a