Main Content

Compare Simulation to Baseline Data

In this example, you use the Simulink Test Manager to add signal tolerances to baseline data. You make changes to the model and run the test to simulate the model. Then, you review the results to compare the simulation output to baseline data.

Open the Test File and Model

1. Load the test file and open the Test Manager.

sltest.testmanager.load("baselineTestFile.mldatx");
sltest.testmanager.view

2. Open the model.

open_system("sldemo_absbrake");

Add Signal Tolerances and Update Model

1. In the Test Manager, in the left pane, select Test Browser, then select the baselineTestCase test case. In the right pane, expand the Baseline Criteria section. Set the absolute tolerance of the Ww signal by setting the value in the Abs Tol column to 15. For more information, see Set Signal Tolerances

The baseline criteria section in the Test Manager. The table displays the logged signals and 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, for the most recent results, expand baselineTestCase and select Baseline Criteria Result. Select the Ww signal. In the Data Inspector, in the Compare pane, select the Ww signal. The upper plot displays the simulation output data, baseline data, and tolerance. 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 specified tolerance when compared to the baseline data.

The embedded Simulation Data Inspector displays the Ww signals from the baseline data and the simulation output. The simulation output is within tolerance.

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. In the Results and Artifacts pane, the test case displays a failed status.

The baselineTestCase results in the Results and Artifacts pane. The test case indicates a failed status.

In the Compare pane of the Data Inspector tab, in the Baseline Criteria Result section, select the slp signal. 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.

The upper plot shows the baseline and simulation data for the slp signal. The plot below displays the difference between the baseline and simulation signals for slp.

See Also

Topics