slvnvruntest

Simulate model using input data

Syntax

outData = slvnvruntest(model, dataFile)
outData = slvnvruntest(model, dataFile, runOpts)
[outData, covData] = slvnvruntest(model, dataFile, runOpts)

Description

outData = slvnvruntest(model, dataFile) simulates model using all the test cases in dataFile. outData is an array of Simulink.SimulationOutput objects. Each array element contains the simulation output data of the corresponding test case.

outData = slvnvruntest(model, dataFile, runOpts) simulates model using all the test cases in dataFile. runOpts defines the options for simulating the test cases.

[outData, covData] = slvnvruntest(model, dataFile, runOpts) simulates model using the test cases in dataFile. When the runOpts field coverageEnabled is true, the Simulink® Verification and Validation™ software collects model coverage information during the simulation. slvnvruntest returns the coverage data in the cvdata object covData.

Input Arguments

model

Name or handle of the Simulink model to simulate

dataFile

Name of the data file or structure that contains the input data. You can generate dataFile using the Simulink Design Verifier™ software, or by running the slvnvlogsignals function.

runOpts

A structure whose fields specify the configuration of slvnvruntest.

FieldDescription

testIdx

Test case index array to simulate from dataFile. If testIdx is [], slvnvruntest simulates all test cases.

Default: []

signalLoggingSaveFormat

Specifies signal logging data format for:

  • Signals connected to the outports of the model

  • Intermediate signals that are already configured for logging

Valid values are:

  • 'Dataset' (default) — slvnvruntest stores the data in Simulink.SimulationData.
    Dataset
    objects.

  • 'ModelDataLogs'slvnvruntest stores the data in Simulink.ModelDataLogs objects.

coverageEnabled

If true, specifies that the Simulink Verification and Validation software collect model coverage data during simulation.

Default: false

coverageSetting

cvtest object for collecting model coverage. If [], slvnvruntest uses the existing coverage settings for model.

Default: []

Output Arguments

outData

An array of Simulink.SimulationOutput objects that simulating the test cases generates. Each Simulink.SimulationOutput object has the following fields.

Field NameDescription

tout_slvnvruntest

Simulation time

xout_slvnvruntest

State data

yout_slvnvruntest

Output signal data

logsout_slvnvruntest

Signal logging data for:

  • Signals connected to outports

  • Signals that are configured for logging on the model

covData

cvdata object that contains the model coverage data collected during simulation.

Examples

Analyze the sldemo_mdlref_basic model and log the input signals to the CounterA Model block:

open_system('sldemo_mdlref_basic');
loggedData = slvnvlogsignals('sldemo_mdlref_basic/CounterA');

Using the logged signals, simulate the model referenced in the Counter block (sldemo_mdlref_counter):

runOpts = slvnvruntestopts;
runOpts.coverageEnabled = true;
open_system('sldemo_mdlref_counter');
[ outData ] = slvnvruntest('sldemo_mdlref_counter',...
    loggedData, runOpts);

Examine the output data from the first test case using the Simulation Data Inspector:

Simulink.sdi.createRun('Test Case 1 Output', 'namevalue',...
    {'output'}, {outData(1).find('logsout_slvnvruntest')});
Simulink.sdi.view;

More About

expand all

Tips

The dataFile that you create with a Simulink Design Verifier analysis or by running slvnvlogsignals contains time values and data values. When you simulate a model using these test cases, you might see missing coverage. This issue occurs when the time values in the dataFile are not aligned with the current simulation time step due to numeric calculation differences. You see this issue more frequently with multirate models—models that have multiple sample times.

Was this topic helpful?