Main Content

sltest.testmanager.LoggedSignal class

Package: sltest.testmanager

Create or modify logged signals for use as simulation outputs

Description

An instance of sltest.testmanager.LoggedSignal stores a logged signal for use in a sltest.testmanager.LoggedSignalSet object. You can use the logged signal for data comparison with baseline criteria, equivalence criteria, custom criteria, or in iterations.

Creation

Description

example

obj = addLoggedSignal(lgset,BlockPath,PortIndex) creates and adds a LoggedSignal object to a LoggedSignalSet object. You must open or load the model to add signals from the model.

obj = addDataStoreSignal(lgset,BlockPath) creates and adds an sltest.testmanager.LoggedSignal object to a set when the LoggedSignal object derives from a data store or Simulink.Signal object. You must open or load the model to add a LoggedSignal from the model.

objs = getLoggedSignals(lgset) creates and returns a vector of the LoggedSignal objects that are stored in a LoggedSignalSet.

Input Arguments

expand all

Object that can contain one or more LoggedSignal objects.

Simulink.BlockPath object that uniquely identifies the block that outputs the signal.

Index of the output port for the block designated by BlockPath, starting from 1.

Properties

expand all

Name of the signal. This property is read-only.

Simulink.BlockPath object that uniquely identifies the block that outputs the signal. This property is read-only.

Index of the output port for the block designated by BlockPath, starting from 1. This property is read-only.

Name of the block path for the object. If the signal corresponds to a Simulink.Signal object, the field displays 'base workspace' or 'model workspace' to describe the location of the object. This property is read-only.

Indicates whether the signal is logged during test case execution.

Indices for subplot location.

Methods

expand all

Examples

collapse all

Open a model and create a signal set.

% Open model
sldemo_absbrake

% Create test case
tf = sltest.testmanager.TestFile(strcat(pwd,'\mytf.mldatx'));
ts = sltest.testmanager.TestSuite(tf,'myts');
tc = sltest.testmanager.TestCase(ts,'baseline','mytc');

% Create signal set
lgset = tc.addLoggedSignalSet;

Select the Vehicle Speed block and enter gcb. Use the returned path to create a Simulink.BlockPath object.

% Add signals to set
bPath = Simulink.BlockPath('sldemo_absbrake/Vehicle speed');
sig1 = lgset.addLoggedSignal(bPath,1);
sig2 = lgset.addLoggedSignal(bPath,2);

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

% Save test file
saveToFile(tf);
Introduced in R2019a