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
Open the model using
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.
From the Test Manager toolstrip, click New 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.
Right-click the baseline test case in the Test Browser pane, and select Rename. Rename the test case to
Slip Baseline Test.
Under System Under Test in the test case, click the Use current model button to load the
sldemo_absbrakemodel into the test case.
To record a baseline from the system under test, under Baseline Criteria, click Capture.
In the Capture Baseline dialog box, for the file format, select
Excel. Specify a location to save the baseline to and click Capture.
The baseline criteria file and the logged signals appear in the table. Set the Absolute Tolerance of the
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
sldemo_absbrakemodel, set the Desired relative slip constant block to
In the Test Manager, select the Slip Baseline Test case in the Test Browser pane.
On the Test Manager toolstrip, click Run.
In the Results and Artifacts pane, the new test result appears at the top of the table.
Expand the results until you see the baseline criteria result. Right-click the result and select Expand All Under.
yout.Wwpasses, but the overall baseline test fails because other signal comparisons specified in the Baseline Criteria section of the test case were not satisfied.
To view the
yout.Wwsignal comparison between the model and the baseline criteria, expand
Baseline Criteria Resultand click the option button next to the
The Comparison tab opens and shows the criteria comparisons for the
yout.Wwsignal and the tolerance.
You can also view signal data from the simulation. Expand
Sim Outputand select the signals you want to plot.
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.