sltest.harness.set
Change test harness property
Description
sltest.harness.set(
changes a property, specified by one
harnessOwner
,harnessName
,Name,Value
)Name
,Value
pair argument, for the test
harness harnessName
owned by the model or component
harnessOwner
.
Examples
Change the Name of a Test Harness
This example shows how to change the name of a test harness using sltest.harness.set
.
Create a Test Harness
Load the f14
model and create a test harness for the Controller
subsystem.
f14 sltest.harness.create('f14/Controller','Name','Harness1')
ans = struct with fields:
model: 'f14'
name: 'Harness1'
description: ''
ownerHandle: 344.0022
ownerFullPath: 'f14/Controller'
ownerType: 'Simulink.SubSystem'
verificationMode: 'Normal'
saveExternally: 0
rebuildOnOpen: 0
rebuildModelData: 0
postRebuildCallback: ''
graphical: 0
origSrc: 'Inport'
origSink: 'Outport'
synchronizationMode: 'SyncOnOpenAndClose'
existingBuildFolder: ''
functionInterfaceName: ''
Change the Test Harness Name
Change the name from Harness1
to ControllerHarness
.
sltest.harness.set('f14/Controller','Harness1','Name','ControllerHarness')
Close the Model
close_system('f14',0)
Input Arguments
harnessOwner
— Model or component
character vector | double
Model or component handle, or path, specified as a character vector or double
Example: 1.9500e+03
Example: 'model_name'
Example: 'model_name/Subsystem'
harnessName
— Harness name
character vector
The name of the harness, specified as a character vector.
Example: 'harness_name'
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.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'Name','updated_harness'
specifies
a new harness name 'updated_harness'
.
Name
— New harness name
character vector
The new name for the harness, specified as the comma-separated pair consisting of
'Name'
and a valid MATLAB filename.
Example: 'Name','new_harness_name'
Description
— New harness description
character vector
The new description for the harness, specified by the comma-separated
pair consisting of 'Description'
and a character
vector.
Example: 'Description','An updated test harness'
SynchronizationMode
— Specifies the synchronization behavior of the component under test
"SyncOnOpenAndClose"
(default) | "SyncOnOpen"
| "SyncOnPushRebuildOnly"
Option to specify when the component under test synchronizes the main model and the test harness. Subsystem model test harnesses are always synchronized with their underlying model.
"SyncOnOpenAndClose"
rebuilds the component under test from the main model when the test harness opens, and pushes changes from the component under test to the main model when the test harness closes."SyncOnOpen"
rebuilds the component under test from the main model when the test harness opens. It does not push changes from the component under test to the main model when the test harness closes."SyncOnPushRebuildOnly"
rebuilds and pushes changes only when you manually initiate rebuild or push for the entire test harness.
For more information, see Synchronize Changes Between Test Harness and Model
Example: SynchronizationMode="SyncOnOpen"
RebuildOnOpen
— Sets the harness rebuild command to execute when the harness opens
false
or 0
(default) | true
or 1
Option to have the harness rebuild when it opens, specified as numeric or logical
1
(true
) or 0
(false
).
Example: RebuildOnOpen=true
ExistingBuildFolder
— Path to folder of existing generated code verified using SIL/PIL
string | character vector
Path to main build folder of existing generated code verified using
Software-in-the-Loop (SIL) or Processor-in-the-Loop (/PIL), specified as a string or
character vector. If you specify a build folder, the function uses the existing code in
that folder, which enables faster harness creation time. If you do not specify a build
folder, the function regenerates the code. ExistingBuildFolder
does
not apply if you are create multiple harnesses. You cannot set a default value for this
property in an sl_customization
file or by using
sltest.harness.setHarnessCreateDefaults
.
Example: ExistingBuildFolder="C:\TestMdl\SILHarness\Amplifier_ert_rtw"
RebuildModelData
— Sets configuration set and model workspace entries to be updated during the test harness rebuild
false
or 0
(default) | true
or 1
Option to have the configuration set and model workspace entries updated during test harness
rebuild, specified as numeric or logical 1
(true
)
or 0
(false
). This option is set to
true
for Subsystem model test harnesses.
Example: RebuildModelData=true
RebuildWithoutCompile
— Sets the harness to rebuild without compiling the main model
false
(default) | true
Option to rebuild the harness without compiling the main model,
in which cached information from the most recent compile is used to
update the test harness workspace, and conversion subsystems are not
updated, specified as the comma-separated pair consisting of 'RebuildWithoutCompile'
and true
or false
.
Example: 'RebuildWithoutCompile',true
PostRebuildCallback
— Harness customization after rebuild
character vector
Use a post rebuild callback function to customize a test harness. The post rebuild callback function executes after the harness rebuilds. For more information, see Customize Test Harnesses.
Example: 'PostRebuildCallback','HarnessCustomization'
FunctionInterfaceName
— Name of the function interface to associate to the harness
string | character vector
Name of the function interface to associate with the harness, specified as a string or character vector. This option applies only to reusable library components with function interfaces.
Example: 'FunctionInterfaceName','double_RLS'
Version History
Introduced in R2015a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)