Main Content

本页采用了机器翻译。点击此处可查看英文原文。

创建并运行背靠背测试

此示例显示如何创建和运行背靠背测试(也称为等效性测试)。背靠背测试将普通仿真的结果与软件在环、处理器在环或硬件在环仿真生成的代码结果进行比较。

  1. 打开 SILBlock 模型。

    openExample('SILBlock.slx')

  2. 单击“Controller”子系统以选择它。

    Model with controller subsystem selected

  3. 要打开 Simulink Test 选项卡,请在 App 选项卡的模型验证、确认和测试部分中点击 Simulink Test

  4. 要打开测试管理器,请在测试选项卡中点击 Simulink 测试管理器

    Tests tab with Simulink Test Manager button highlighted

  5. 点击 新建 > 为模型组件创建测试。打开“创建模型组件测试”向导。

  6. 要指定顶层模型,点击顶层模型字段旁边的使用当前模型按钮

    要添加您在模型中选择的 Controller 子系统,点击使用当前选择的组件

    First page of wizard with top model and component

  7. 单击下一步来指定如何获取测试框架输入。选择使用来自顶层模型的组件输入作为测试输入。此选项运行模型并使用所选模型组件的输入创建测试框架输入。

    Test Inputs, second page of wizard, with Use component input selected

  8. 点击下一步选择测试方法。点击执行背靠背测试。对于仿真 1,使用普通。对于仿真 2,使用软件在环(SIL)

    Verification strategy, third page of wizard, with perform back to back testing selected with the simulations set to Normal and software in the loop

  9. 单击下一步指定测试框架输入源、格式以及保存测试数据和生成的测试的位置。对于要保存测试数据的指定文件格式,选择 EXCEL。对于 Specify the location to save test data,使用默认位置名称。输入 B2BtestFile 作为测试文件位置

    Generated test, last page of the wizard, with Inports as the harness source, Excel as the file format, and save location for test data and generated tests specified

  10. 点击完成。测试框架和测试用例已创建并且向导关闭。

    Test Manager with generated test case

运行背靠背测试

要运行背靠背测试,点击运行

查看连续测试结果

展开结果和工件面板中的结果层次结构。在等效性准则结果下选择 Out1 1。上图显示输出信号对齐,下图显示输出信号之间没有差异。

Test Manager results plot of the baseline and simulation output signals, and another plot of the output differences

另请参阅

| |

相关主题