Main Content

addParameterOverride

Class: sltest.testmanager.ParameterSet
Namespace: sltest.testmanager

Add parameter override to parameter set

Syntax

ovr = addParameterOverride(ps,ParamName,ParamValue)
ovr = addParameterOverride(___,Name,Value)

Description

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

ovr = addParameterOverride(___,Name,Value) specifies options using one or more name-value arguments in addition to the input arguments in previous syntax.

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 ParamName is a block parameter, use the programmatic name.

Data Types: char | string

Parameter value to override, specified in the format determined by the parameter type. If ParamValue is a string scalar, it is evaluated as a MATLAB® expression when the test executes.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: ovr = addParameterOverride(ps,'a',2,BlockPath='myModel/Controller1')

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: ovr = addParameterOverride(ps,'a',2,'BlockPath','myModel/Controller1')

Block path of the parameter to override, specified as a string 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 ParamName and BlockPath properties must be unique within a parameter set.

Data Types: char | string

Workspace that contains the parameter to override, specified as a string or character vector. Specify Workspace if you are overriding a parameter in a model reference. Different model references can have a model workspace parameter with the same name, so Workspace indicates which workspace parameter to override.

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.

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.

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