Main Content

sltest.testmanager.LoggedSignal Class

Namespace: 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.

sldemo_absbrake

Create a test file, test suite and test case for this model.

tf = sltest.testmanager.TestFile(strcat(pwd,'\addSigs.mldatx'));
ts = sltest.testmanager.TestSuite(tf,'addSigs_suite');
tc = sltest.testmanager.TestCase(ts,'baseline','addSigs_testcase');

Create a signal set.

lgset = tc.addLoggedSignalSet;

Open the Vehicle Dynamics block and then the Vehicle block. Select the Vehicle Speed block. Then, enter gcb to obtain the full block path. Use the returned path to create a Simulink.BlockPath object.

blkpath=['sldemo_absbrake/'...
    'Vehicle Dynamics/Vehicle  /Vehicle Speed'];
bPath = Simulink.BlockPath(blkpath);
sig1 = lgset.addLoggedSignal(bPath,1);
sig2 = lgset.addLoggedSignal(bPath,2);

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

Clear the Test Manager.

sltest.testmanager.clear
sltest.testmanager.clearResults
sltest.testmanager.close

Version History

Introduced in R2019a