Main Content

addParameterOverride

Class: sltest.testmanager.ParameterSet
Package: sltest.testmanager

Add parameter override to parameter set

Syntax

ovr = addParameterOverride(ps,Name,Value)
ovr = addParameterOverride(ps,Name,Value,blockPath)

Description

ovr = addParameterOverride(ps,Name,Value) adds a parameter override to a parameter set and returns a parameter override object, sltest.testmanager.ParameterOverride.

ovr = addParameterOverride(ps,Name,Value,blockPath) adds a parameter override that overrides a block or block mask parameter.

Input Arguments

expand all

Parameter set to which you want to add the override, specified as a sltest.testmanager.ParameterSet object.

Name of the parameter to override, specified as a string or character vector. If Name is a block parameter, use the programmatic name.

Data Types: char | string

Parameter value to override, specified as a numeric or string scalar. If Value is a string scalar, it is evaluated as a MATLAB® expression when the test executes.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | string

Block path of the parameter to override, specified as a string scalar or character vector. Specify blockPath only if the parameter to override is a block or block mask parameter stored in a mask workspace. The combination of Name and blockPath properties must be unique within a parameter set.

Data Types: char | string

Output Arguments

expand all

Parameter override added to the parameter set, returned as an sltest.testmanager.ParameterOverride object.

Examples

expand all

Open the model for this example.

openExample('sldemo_absbrake');

Create the test file, test suite, and test case structure.

tf = sltest.testmanager.TestFile("API Test File");
ts = createTestSuite(tf,"API Test Suite");
tc = createTestCase(ts,"baseline","Baseline API Test Case");

Remove the default test suite.

tsDel = getTestSuiteByName(tf,"New Test Suite 1");
remove(tsDel);

Assign the system under test to the test case.

setProperty(tc,"Model","sldemo_absbrake");

Capture the baseline criteria.

baseline = captureBaselineCriteria(tc,"baseline_API.mat",true);

Test a new model parameter by overriding it in the test case parameter set.

ps = addParameterSet(tc,"Name","API Parameter Set");
po = addParameterOverride(ps,"m",55);

Open the model for this example.

openExample('sldemo_absbrake');

Create the test file, test suite, and test case structure.

tf = sltest.testmanager.TestFile("API Test File");
ts = createTestSuite(tf,"API Test Suite");
tc = createTestCase(ts,"baseline","Baseline API Test Case");

Remove the default test suite.

tsDel = getTestSuiteByName(tf,"New Test Suite 1");
remove(tsDel);

Assign the system under test to the test case.

setProperty(tc,"Model","sldemo_absbrake");

Capture the baseline criteria.

baseline = captureBaselineCriteria(tc,"baseline_API.mat",true);

Test a new value of the Constant block labeled Desired relative slip by overriding it in the test case parameter set.

ps = addParameterSet(tc,"Name","API Parameter Set");
po = addParameterOverride(ps,"Value",0.22,...
"sldemo_absbrake/Desired relative slip");

Version History

Introduced in R2015b