Main Content

Compare Model Output to Baseline Data

To test the simulation output of a model against a defined baseline, use a baseline test case. This example uses the sldemo_absbrake model to compare the simulation output to a baseline captured from an earlier state of the model.

Create the Test Case

  1. Open the model using openExample('sldemo_absbrake').

  2. To open the Test Manager from the model, on the Apps tab, under Model Verification, Validation, and Test, click Simulink Test. Then, on the Tests tab, click Simulink Test Manager.

  3. From the Test Manager toolstrip, click New > > Test File to create a test file. Name and save the test file.

    The test file consists of a test suite that contains one baseline test case. They appear in the Test Browser pane.

  4. Right-click the baseline test case in the Test Browser pane, and select Rename. Rename the test case to Slip Baseline Test.

  5. Under System Under Test in the test case, click the Use current model button to load the sldemo_absbrake model into the test case.

  6. To record a baseline from the system under test, under Baseline Criteria, click Capture.

  7. In the Capture Baseline dialog box, for the file format, select Excel. Specify a location to save the baseline to and click Capture.

  8. The baseline criteria file and the logged signals appear in the table. Set the Absolute Tolerance of the Ww signal to 15.

    Baseline criteria table

Tip

To add or remove columns in the baseline criteria table, click the column selector button .

For more information about tolerances and criteria, see Set Signal Tolerances.

Run the Test Case and View Results

  1. In the sldemo_absbrake model, set the Desired relative slip constant block to 0.22.

  2. In the Test Manager, select the Slip Baseline Test case in the Test Browser pane.

  3. On the Test Manager toolstrip, click Run.

    In the Results and Artifacts pane, the new test result appears at the top of the table.

  4. Expand the results until you see the baseline criteria result. Right-click the result and select Expand All Under.

    The signal yout.Ww passes, but the overall baseline test fails because other signal comparisons specified in the Baseline Criteria section of the test case were not satisfied.

  5. To view the yout.Ww signal comparison between the model and the baseline criteria, expand Baseline Criteria Result and click the option button next to the yout.Ww signal.

    Baseline criteria result signals

    The Comparison tab opens and shows the criteria comparisons for the yout.Ww signal and the tolerance.

    Plots of baseline criteria signals and differences

  6. You can also view signal data from the simulation. Expand Sim Output and select the signals you want to plot.

    Simulation output signals

    The Visualize tab opens and plots the simulation output.

For information on how to export results and generate reports from results, see Export Test Results.

See Also

Related Topics