Compare Simulation to Baseline Data
In this example, you use the Simulink Test Manager to add signal tolerances to baseline data. Then, you make changes to the model, run the test to simulate the model, and review the results.
Open the Test File and Model
1. Use the files from the previous step, or run these commands to reopen the files needed for the example.
sltest.testmanager.load("baselineTestFile.mldatx"); sltest.testmanager.view open_system("sldemo_absbrake");
Add Signal Tolerances and Update Model
1. In the Test Manager, in the baselineTestCase
test case, expand the Baseline Criteria section. Set the Absolute Tolerance of the Ww
signal to 15
. For more information, see Set Signal Tolerances
2. In the sldemo_absbrake
model, set the Desired relative slip constant block to 0.22
.
Run the Test and Review Results
1. In the Test Manager, select baselineTestCase
and click Run.
2. In the Results and Artifacts pane, expand the results in the Baseline Criteria Result section. Select the Ww
signal.
The Comparison tab displays the simulation output data, baseline data and tolerance in the upper plot. The lower plot displays the tolerance and the difference between the simulation output and the baseline data. The Ww
signal passes the test, because the signal is stays within the specifed tolerance when compared to the baseline data.
3. The overall test fails because the other signal comparisons do not satisfy the tolerance values specified in the Baseline Criteria section of the test case.
Select the slp
signal in the Baseline Criteria Result section. In the Comparison tab, the upper plot shows that the simulation output and baseline data are not the same. The lower plot displays a difference greater than the zero difference required to satisfy the baseline criteria.