Capture signal data in your test results by adding signals to the Simulation Outputs section of the test case. Each output is called a logged signal. Signals listed in Simulation Outputs appear in the test results along with signals that are already selected for logging in Simulink®.
You can use logged signals for data comparison in baseline criteria, equivalence criteria,
custom criteria, and for data visualization in the Simulation Data Inspector. Logged signals
enable you to further test your Simulink model without changing the model. In addition to signals from the top model,
you can also log signals from subsystems and model references. You can select signals
associated with local and global data store memory, and from data store memory that uses a
Simulink.Signal
object.
To add signals:
Open the model
sltestFlutterSuppressionSystemExample
.
Use sltestmgr
to open the Test Manager.
In the Test Manager, under Simulation Outputs, click Add.
In the system under test, highlight blocks or signals that you want to log. To select multiple items, click and drag a selection box over multiple items.
A dialog box appears. Select signals in the dialog box.
Continue adding signals to the test case. Each time you select a signal, the dialog box also shows previously logged signals. You can remove a signal from logging by clearing the selection.
When you finish adding signals, return to the Test Manager and click Done.
The signals appear in the Logged Signals table in the test case.
To add a signal set, click the Add arrow and select Signal Set.
To specify a specific plot for a signal, enter a number in the Plot Index column. By default, the signals appear on one plot.
You can specify to display the plot immediately after running the test by selecting the Plot signals on the specified plots after simulation check box.
After you run the test, the logged signals appear in the test case results under Sim Output. Select each signal to display on the plot. If you specify a plot index, the signal appears in the plot number you specified.
Perform similar steps to add simulation output associated with data store memory:
Open the model sldemo_mdlref_dsm
, which contains local and
global data store memory.
In a test case, from the top model, add the Sine Wave block for logging.
Click on the Data Store Read block in the top model. Click on
the click to update diagram box. The dialog box displays
the signal associated with the block and the data associated with the
Simulink.Signal
object in the base workspace. The model
displays the signal storage class for the block,
(global)
.
Select both signals in the dialog box.
Double-click the model reference sldemo_mdlref_dsm_bot
to
open it, and then open the subsystem PositiveSS
. Select the
Data Store Write block. The table displays the input signal
from the Gain block and the data store memory,
RefSignalVal
.
Select the RefSignalVal
data store memory for logging. The
dialog box uses a different icon to indicate the data store memory.
Finish selecting signals by clicking Done in the Test
Manager window. In the Test manager, the signals appear under Logged
Signals. The Source column displays the full
path information for each signal. For the signal associated with the
Simulink.Signal
object, Source displays
the workspace location of the Simulink.Signal
object.
In addition to logging an entire Bus block, you can select one or more individual signals within a bus and add them to the Logged Signals section of Test Manager. For large buses, adding only the needed signals might reduce the amount of time it takes a test case to run.
Open the model, sldemo_absbrake
.
Use sltestmgr
to open the Test Manager.
Click New > Test File to create a new test file. Name and save the file.
Under System Under Test, click the Use current model icon.
Under Simulation Outputs, click Add.
In the system under test, select the signal exiting the Bus,
yout
.
A dialog box appears. Select the desired bus or bus leaf signals in the dialog box. Three horizontal lines indicate the whole bus. A single horizontal line next to a signal name indicates that it is a bus leaf signal. If the leaf signals do not appear in the dialog, click Click to update diagram.
Continue adding signals to the test case, such as the non-bus
Sd
and tire torque
signals
When you finish adding signals, return to the Test Manager and click Done.
The signals appear in the Logged Signals table in the test case.
To add a signal set, click the Add arrow and select Signal Set.
To specify a specific plot for a signal, enter a number in the Plot Index column. By default, the signals appear on one plot.
You can specify to display the plot immediately after running the test by selecting the Plot signals on the specified plots after simulation check box.
Simulink.Signal
| sltest.testmanager.LoggedSignal
| sltest.testmanager.LoggedSignalSet
| sltest.testmanager.TestCase
| Test Manager