主要内容

将仿真与基线数据进行比较

在此示例中,您使用 Simulink 测试管理器向基线数据添加信号容差。您对模型进行更改并运行测试以仿真模型。然后,您查看结果,以将仿真输出与基线数据进行比较。

打开测试文件和模型

1.加载测试文件并打开测试管理器。

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

2.打开模型。

open_system("sldemo_absbrake");

添加信号容差并更新模型

1.在测试管理器的左窗格中,选择测试浏览器,然后选择 baselineTestCase 测试用例。在右窗格中,展开基线准则部分。通过将绝对容差列中的值设置为 15,设置 Ww 信号的绝对容差。有关详细信息,请参阅设置信号容差

The baseline criteria section in the Test Manager. The table displays the logged signals and tolerances.

2.在 sldemo_absbrake 模型中,将名称为 Desired relative slip 的 Constant 模块设置为 0.22

运行测试并查看结果

1.在测试管理器中,选择 baselineTestCase 并点击运行

2.在结果和工件窗格中,展开 baselineTestCase 并选择基线准则结果,即可查看最新结果。选择 Ww 信号。在数据检查器比较窗格中,选择 Ww 信号。上面的图显示了仿真输出数据、基线数据和容差。下面的图显示了容差以及仿真输出和基线数据之间的差值。Ww 信号通过测试,原因是与基线数据比较时,该信号保持处于指定的容差内。

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 baselineTestCase results in the Results and Artifacts pane. The test case indicates a failed status.

数据检查器选项卡的比较窗格中,在基线准则结果部分,选择 slp 信号。上面的图显示了仿真输出与基线数据并不相同。下面的图显示了差值大于满足基线准则所要求的零差值。

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.

另请参阅

主题