Main Content

sltest.testmanager.OutputTriggerResult Class

Namespace: sltest.testmanager

Signal logging output trigger results

Since R2023a

Description

Objects of the sltest.testmanager.OutputTriggerResult contain the signal logging output trigger results from the iteration results in the sltest.testmanager.TestIterationResult object. If the test case does not have iterations, the trigger results are from the test case results in the sltest.testmanager.TestCaseResult object.

The sltest.testmanager.OutputTriggerResult class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

otr = sltest.testmanager.TestIterationResult.getOutputTriggerResults(tir) creates an output trigger result object for the test iteration result object tir.

otr = sltest.testmanager.TestIterationResult.getOutputTriggerResults(tcr) creates an output trigger result for the test case result object tcr. Use this syntax only if the test case does not have iterations.

Properties

expand all

Signal logging start mode, returned as a member of the sltest.testmanager.TriggerMode enumeration class.

Attributes:

GetAccess
public
SetAccess
private

Signal logging stop mode, returned as a member of the sltest.testmanager.TriggerMode enumeration class.

Attributes:

GetAccess
public
SetAccess
private

Condition that started signal logging, returned as a logical MATLAB expression.

Attributes:

GetAccess
public
SetAccess
private

Condition that stopped signal logging, returned as a logical MATLAB expression.

Attributes:

GetAccess
public
SetAccess
private

Data Types: string

Time after simulation start that signal logging started, in seconds, returned as a scalar double value. This property applies only if the StartLoggingMode property is set to sltest.testmanager.TriggerMode.Duration.

Attributes:

GetAccess
public
SetAccess
private

Time after logging start that signal logging stopped, in seconds, returned as a scalar double. This property applies only if the StopLoggingMode property is set to sltest.testmanager.TriggerMode.Duration.

Attributes:

GetAccess
public
SetAccess
private

Whether the logged signal start was shifted to time 0, returned as true or false.

Attributes:

GetAccess
public
SetAccess
private

Model simulation time when start triggered occurred, in seconds, returned as a scalar double value.

Attributes:

GetAccess
public
SetAccess
private

Model simulation time when stop trigger occurred, in seconds, returned as a scalar double value.

Attributes:

GetAccess
public
SetAccess
private

Relative signal logging start time, in seconds, returned as a scalar double value. The LoggedRunStartTime property depends on the value of the ShiftToZero property. If ShiftToZero is false, LoggedRunStartTime is the same as the LoggingStartTimeInSim property. If ShiftToZero is true, LoggedRunStartTime is 0.

Attributes:

GetAccess
public
SetAccess
private

Relative signal logging stop time, in seconds, returned as a scalar double value. The LoggedRunStopTime property depends on the value of the ShiftToZero property. If ShiftToZero is false, LoggedRunStopTime is the same as the LoggingStopTimeInSim. If ShiftToZero is true, the LoggedRunStartTime is the value of the LoggingStopTimeInSim property minus the number of seconds the signal was shifted.

Attributes:

GetAccess
public
SetAccess
private

Examples

collapse all

Open the model.

openExample('sldemo_absbrake')

Create the test file, test suite, and test case. Remove the default test suite.

tf = sltest.testmanager.TestFile('mytf');
ts = sltest.testmanager.TestSuite(tf,'myts');
tc = sltest.testmanager.TestCase(ts,'baseline','mytc');

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_triggers.mat',true);

Create a logged signal set and add the Wheel Speed block output signal to it.

sigset = addLoggedSignalSet(tc);
bPath = Simulink.BlockPath('sldemo_absbrake/Wheel Speed');
Ww = sigset.addLoggedSignal(bPath,1);

Set the start and stop triggers.

ot = getOutputTrigger(tc);
ot.StartLoggingMode = sltest.testmanager.TriggerMode.Condition;
ot.StartLoggingCondition = 'Ww < 40';
ot.StopLoggingMode = sltest.testmanager.TriggerMode.Duration;
ot.StopLoggingDuration = 4;

Open the Test Manager.

sltest.testmanager.view

To map the symbols used in the output trigger, in the left pane, click the mytc test case. In the right pane, expand Simulation Outputs. In the Output Triggers subsection, point to the Ww symbol, then select Map to model element.

Map to model element menu option for symbol

In the model, select the Ww signal and in the Connect dialog box, select Ww. In the Test Manager click Done.

At the command line, run the test and obtain the result set and results for the test file, test suite, test case, and output triggers.

resultset = run(tf);
tfr = getTestFileResults(resultset);  
tsr = getTestSuiteResults(tfr);  
tcr = getTestCaseResults(tsr);  
otr = getOutputTriggerResults(tcr);

In the Results and Artifacts pane of the Test Manager, notice that the baseline test fails because the triggered result start time is shifted to zero, but the baseline data is not shifted.Plot comparing baseline and triggered results

Version History

Introduced in R2023a