In this example, use a simulation test case with the sldemo_absbrake
model to test for simulation run-time
errors.
Configure the model to check if the stopping distance exceeds an upper bound.
Open the model sldemo_absbrake
.
Add the Check Static Upper Bound block from the Model Verification library to the model.
Connect the Check Static Upper Bound block
to the Sd
signal.
In the Check Static Upper Bound block
dialog box, and set Upper bound to 725
.
To open the Test Manager, on the Apps tab, under Model Verification, Validation, and Test, click Simulink Test. Then, on the Tests tab, click Simulink Test Manager.
To create a test file, click New. Name and save the test file.
The new test file consists of a test suite that contains one baseline test case. They appear in the Test Browser pane.
Select New > Simulation Test.
Right-click the new simulation test case in the Test
Browser pane, and select Rename.
Rename the test case to Upper Bound Test
.
In the test case, under System Under Test,
click the Use current model button to assign the
sldemo_absbrake
model
to the test case.
Under Parameter Overrides, click Add to add a parameter set.
In the dialog box, click the Refresh button to update the model parameter
list.
Select the check box next to the workspace variable m
.
Click OK.
Double-click the Override Value and
enter 55
.
This value overrides the parameter value in the model when the simulation runs.
To restore the default value of a parameter, clear the value in the Override Value column and press Enter.
In the Test Browser pane, select
the Upper Bound Test
case.
In the Test Manager toolstrip, click Run. The test results appear in the Results and Artifacts pane.
Expand the test results, and double-click Upper
Bound Test
.
A new tab displays the outcome and results summary of the simulation test.
The result indicates a test failure. In this case, the stopping distance exceeded the upper bound of 725 and triggered an assertion from the Check Static Upper Bound block. The Errors section contains the assertion details.