Main Content

slvnvmakeharness

Generate Simulink Coverage harness model

Description

harnessFilePath = slvnvmakeharness(model) generates a test harness from model, which is a handle to a Simulink® model or a character vector or string with the model name. slvnvmakeharness returns the path and file name of the generated harness model in harnessFilePath. slvnvmakeharness creates a harness model containing the Model block, a Signal Builder block, and a size-type conversion block, by default. The test harness includes one default test case that specifies the default values for all input signals.

harnessFilePath = slvnvmakeharness(model, dataFile) generates a test harness from the data file dataFile.

example

harnessFilePath = slvnvmakeharness(model, dataFile, harnessOpts) generates a test harness from model by using the dataFile and harnessOpts, which specifies the harness creation options. Requires '' for dataFile if dataFile is not available. The default dataFile argument creates a test harness with a single test case with default values for the inputs.

Examples

collapse all

Create a test harness for the sldemo_mdlref_house model using the default options:

open_system('sldemo_mdlref_house');
harnessOpts = slvnvharnessopts;
[harnessfile] = slvnvmakeharness('sldemo_mdlref_house', '', harnessOpts);

Input Arguments

collapse all

Simulink model, specified as a character array, string array, or model handle.

Data structure, specified as a structure, or as a character array or string array containing the name of the .mat file. Use slvnvlogsignals or slvnvmergedata to create this structure. The structure contains information about the model, its input and output ports, and any preexisting test signals. Use this input when you have previously logged test data that you want to import into a new test harness.

Harness options, specified as a structure. Use slvnvharnessopts to create this structure.

FieldDescription
harnessFilePath

Specifies the file path for creating the harness model. If an invalid path is specified, slvnvmakeharness does not save the harness model, but it creates and opens the harness model. If you do not specify this option, the slvnvoptions object is used. Also, slvnvmakeharness generates a new harness model and saves it in the MATLAB® current folder.

Default: ''

modelRefHarness

Generates the test harness model that includes model in a Model block. When false, the test harness model includes a copy of model.

Default: true

usedSignalsOnly

When true, the Signal Builder block in the harness model has signals for input signals in the model. You must have the Simulink Design Verifier™ software and model must be compatible with that software to detect the input signals.

Default: false

Output Arguments

collapse all

Path and file name of the harness model, returned as a character array.

Version History

Introduced in R2010b