Quantcast

Documentation Center

  • Trial Software
  • Product Updates

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 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);
    

You can also execute multiple test objects with the cvsim command. The following command executes a set of coverage test objects, cvto1, cvto2, ... using the default simulation parameters. cvsim returns the coverage results in a set of cvdata objects, cvdo1, cvdo2, ... and returns the simulation outputs in simOut.

[cvdo1, cvdo2, ..., simOut] = cvsim(cvto1, cvto2, ...)
Was this topic helpful?