Main Content

sltest.testmanager.OutputTrigger Class

Namespace: sltest.testmanager

Signal logging output start and stop triggers

Since R2023a

Description

Use an object of the sltest.testmanager.OutputTrigger class to define signal logging output triggers for a test case. Triggers start and stop signal logging when a condition is true, simulation starts or stops, or after a specified duration. Triggers that you set for a test case apply to all iterations in that test case. If you do not create an OutputTrigger object for your test case, signal logging occurs for the entire simulation.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

ot = sltest.testmanager.TestCase.getOutputTrigger(tc) creates an sltest.testmanager.OutputTrigger object for the specified test case tc.

Properties

expand all

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

Example: ot.StartLoggingMode = sltest.testmanager.TriggerMode.SameAsSim

Attributes:

GetAccess
public
SetAccess
public

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

Example: ot.StopLoggingMode = sltest.testmanager.TriggerMode.Condition

Attributes:

GetAccess
public
SetAccess
public

Condition to start signal logging, specified as a logical MATLAB expression. Define and map the model variables used in the condition expression string as symbols in the Test Manager Simulation Outputs > Output Triggers subsection.

Example: x > 2

Attributes:

GetAccess
public
SetAccess
public

Condition to stop signal logging, specified as a logical MATLAB expression. Define and map the model variables used in the condition expression string as symbols in the Test Manager Simulation Outputs > Output Triggers subsection.

Example: x > 2

Attributes:

GetAccess
public
SetAccess
public

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

Attributes:

GetAccess
public
SetAccess
public

Time after logging start to stop signal logging, in seconds, specified as a scalar double. This property applies only if you set the StopLoggingMode property to sltest.testmanager.TriggerMode.Duration.

Attributes:

GetAccess
public
SetAccess
public

Whether to shift the logged signal start to time 0, specified as logical 1 (true) to shift the signal, or 0 (false) to not shift the signal.

Example: ot.ShiftToZero = false;

Attributes:

GetAccess
public
SetAccess
public

Symbol information, returned as a structure of character arrays. Each structure element is a symbol defined in the test case and mapped to a model element. Use the symbols in the condition expressions.

Attributes:

GetAccess
public
SetAccess
private

Examples

collapse all

This example shows how to create an output trigger object for a test case and set its start duration trigger property.

Create a test file, test suite, and test case.

tf = sltest.testmanager.TestFile('TriggerTestFile');
ts = sltest.testmanager.TestSuite(tf,'Test Suite 1');
tc = sltest.testmanager.TestCase(ts,'baseline','Baseline Test');

Create and view the output trigger object for the test case.

ot = getOutputTrigger(tc)
ot = 
  OutputTrigger with properties:

         StartLoggingMode: SameAsSim
          StopLoggingMode: SameAsSim
    StartLoggingCondition: ''
     StopLoggingCondition: ''
     StartLoggingDuration: 0
      StopLoggingDuration: 0
              ShiftToZero: 1
                  Symbols: {}

Set the signal logging mode to Duration. Set the signal logging to start 5 seconds after the start of simulation. View the updated output trigger object properties.

ot.StartLoggingMode = 'Duration';
ot.StartLoggingDuration = 5
ot = 
  OutputTrigger with properties:

         StartLoggingMode: Duration
          StopLoggingMode: SameAsSim
    StartLoggingCondition: ''
     StopLoggingCondition: ''
     StartLoggingDuration: 5
      StopLoggingDuration: 0
              ShiftToZero: 1
                  Symbols: {}

Version History

Introduced in R2023a