This example shows how to create and run a back-to-back test, which is also known as an equivalence test. Back-to-back tests compare the results of normal simulations with the generated code results from software-in-the-loop, processor-in-the-loop, or hardware-in-the-loop simulations.
Set the current working folder to a writable folder.
To select the component to test, click the
To open the Simulink Test tab, in the Apps tab, in the Model Verification, Validation, and Test section, click Simulink Test.
To open the Test Manager, in the Tests tab, click Simulink Test Manager.
To create a test file, in the Test Manager, click New > Test File and save it as
In the Test Browser pane, right-click
New Test Case 1 and
New Test Suite 1 and then click New > Test for Model Component. The Create Test for Model Component wizard opens.
To specify the Top model and Component to test, fill the fields by clicking the Use currently selected subsystem button next to the Component field.
Click Next to specify how to obtain the test harness inputs. Select Use component input from the top model as test input. This option runs the model and creates the test harness inputs using the inputs to the selected model component.
Click Next to select the testing method. Click
Perform back-to-back testing. For
Click Next to specify the format and where to save the test
data. For Specify the format to save the test data, select
EXCEL. For Specify the location to save the
test data, enter
B2BtestData. The Excel file is
saved to the current working folder.
Click Done. The test harness and test case are created.
To run the back-to-back test, click Run.
Expand the Results hierarchy in the Results and Artifacts panel. Select Out1:1 under Equivalence Criteria Result. The upper plot shows that the output signals align and the lower plot shows that there is zero difference between the output signals.