Video length is 4:03

Debug Baseline Test Failures Using Model Slicer

Model Slicer helps you to manage and debug large models by selecting specific signals and time windows and then highlighting the related model construct. Learn how you can use Model Slicer to debug a baseline test failure and localize the error. When you simulate the model in debug mode, the model components that impact the failed signal are highlighted for each time step. You can move between failure regions to debug the cause of the baseline differences.

Published: 3 Sep 2020

When working with large, complex systems, issues might appear at specific times in a simulation.   How do you localize the problem to debug it faster?

Model slicer helps you to manage and debug large models by selecting signals and time windows of interest and then highlighting the related model construct.

In this video we present how to use model slicer to debug baseline test failure with Simulink Test

In this Fuel Controller System, we launch the Simulink Test App and then launch the Test Manager.

There is a baseline test that we run in debug mode.  This test compares simulation outputs to a fixed baseline

Three signals failed.  

Let’s look at the results of the fuel signal in the Simulation data inspector.  It shows the difference versus the baseline.   

We can use the debug option that appears if the test fails to enter debug mode

From here we launch Model Slicer.

This will set up the debug environment.

The test case is rerun to create new debug results to make sure the failure still exists in the current state of the model.   

The failed signal is automatically plotted in the debugging results and set as the starting point for model slicer

The simulation pauses at the model start time to continue debugging.

The model components that impact the failed signal are highlighted for each time step.

You can use the Step Back and Step Forward buttons to move one step back or forward in simulation time.

For each step the data dependencies highlighted and the port value labels for the active signals are updated

In the Test Manager, click Continue to Failure to continue the model simulation to the beginning of the next failure point. The data cursors show the bounds of the failure region.

At the failure the difference between the Baseline and Sim Output is 0.007.

By tracing the fuel signal back in the model, we see that the it depends on the To Plant subsystem

Inspecting the To Plant there is no change in the value being propagated.

Let’s take a look further back at the Fuel Rate Control

We see that the the fb_correction value is 0. The difference between the Baseline and the Sim Output is 0.007, which is a small value. It might be that fb_correction is not calculated correctly.

In the airflow calc block, we can see that the constant 0 is being pass through the integrator switch block because the control port is evaluating to false.  

To see why this is false, we can turn on highlighting of control dependencies.  

This tells us that fuel_mode value is LOW but Fuel_mode is being compared to the enumerated constant value of RICH.  This is the problem.  It  should be LOW.

Now I exit debug mode.   And make the change to the model.

Next the test is re run and it passes!

Model slicer help isolate the cause of the error to help us fix it.

To learn more or to request a trial of Simulink Check and Simulink Test visit our web page

Related Products