Capture Simulation Data in a Test Case

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.

Add Logged Signals in the Test Manager

To add signals:

  1. Open the model sltestFlutterSuppressionSystemExample.

  2. In the Test Manager, under Simulation Outputs, click Add.

  3. 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.

  4. A dialog box appears. Select signals in the dialog box.

  5. 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.

  6. The signals appear in the Logged Signals table in the test case.

  7. To add a signal set, click the Add arrow and select Signal Set.

  8. 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.

Capture Data from Local and Global Data Stores

Perform similar steps to add simulation output associated with data store memory:

  1. Open the model sldemo_mdlref_dsm, which contains local and global data store memory.

  2. In a test case, from the top model, add the Sine Wave block for logging.

  3. 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).

  4. Select both signals in the dialog box.

  5. 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.

  6. Select the RefSignalVal data store memory for logging. The dialog box uses a different icon to indicate the data store memory.

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

See Also

| | |

Related Topics