Main Content

Debug Slice Simulation by Using Fast Restart Mode

Perform multiple slicer simulations and streamline model debugging workflows by using Model Slicer in fast restart mode. For more information, see Get Started with Fast Restart.

If you enable fast restart mode, you can:

  • Perform multiple slicer simulations efficiently with different inputs, without recompiling the model.

  • Debug a simulation by stepping through the major time steps of a simulation and inspecting how a slice changes. For more information, see Step Through Simulation.

Simulate and Debug a Test Case in a Model Slice

This example shows how the fast restart mode performs slicer simulations with different test case inputs, without recompiling the model. You can simulate a sliced harness model with a test case input and highlight the dependency analysis in the model.

Analyze the highlighted slice by stepping through the time steps. You use the simulation stepper to analyze how the slice changes at each time step.

1. Open the sldvdemo_cruise_control model.

open_system('sldvdemo_cruise_control');

2. Set sldvoptions parameters and analyze the model by using the specified options.

opts = sldvoptions;
opts.Mode = 'TestGeneration';             % Perform test-generation analysis
opts.ModelCoverageObjectives = 'MCDC';    % Specify type of model coverage
opts.SaveHarnessModel = 'on';             % Save harness as model file
[ status, files ] = sldvrun('sldvdemo_cruise_control', opts);
12-Feb-2024 23:57:51
Checking compatibility for test generation: model 'sldvdemo_cruise_control'
Compiling model...done
Building model representation...done

12-Feb-2024 23:57:57

'sldvdemo_cruise_control' is compatible for test generation with Simulink Design Verifier.

Generating tests using model representation from 12-Feb-2024 23:57:57...


Generating output files:

    Harness model:
    /tmp/Bdoc24a_2528353_1329908/tp29a1d587/slcheck-ex45330953/sldv_output/sldvdemo_cruise_control/sldvdemo_cruise_control_harness.slx

12-Feb-2024 23:58:27
Results generation completed.

    Data file:
    /tmp/Bdoc24a_2528353_1329908/tp29a1d587/slcheck-ex45330953/sldv_output/sldvdemo_cruise_control/sldvdemo_cruise_control_sldvdata.mat

After the analysis, the software opens a harness model sldvdemo_cruise_control_harness and saves it in the default location <current_folder>\sldv_output\sldvdemo_cruise_control\sldvdemo_cruise_control_harness.slx.

cruise_control_harness_model.png

3. On the Apps tab, under Model Verification, Validation, and Test gallery, click Model Slicer. Model Slicer compiles the model.

You can enable fast restart after opening the Model Slicer. Select Simulation time window and click the run simulation button. To enable fast restart, in the Record simulation time window, click the here link.

record_simulation_window.png

5. To add Starting Points, in the Model Slicer, click Add all outports..

The throt and target outports are added as the Starting Points.

6. You can simulate a test case and analyze the highlighted dependencies in the slice.

(a) In the Signal Editor block, select Test Case 1.

(b) Simulate the model by using the Run All button run.png in the Simulink® editor. You can also simulate by using the Simulation time window in the Model Slicer.

The slice shows the highlighted dependencies for the Test Case 1 inputs.

fast_restart_test_case_4.png

You can simulate a slice for different test case inputs and analyze the dependency analysis after you generate the slice of the model.

7. You can debug a slicer simulation by using a simulation stepper. For more information see, Step Through Simulation.

stepper_button.png

(a) To debug the simulation for the test case, in the Simulink® Editor for the sldvdemo_cruise_control_slice model, click Step Forward button. You can view the signal values and the highlighted slice at each time step. For more information, see Simulation Stepping Options. The signal values and the dependencies at T=0.010 appears.

slice_step_1.png

(b) To debug the slice at T=0.030, step forward and view the signal values and the highlighted slice.

slice_step_3.png

8. To complete the simulation stepping, click the Run button.

See Also

Highlight Functional Dependencies

Debug Simulations in the Simulink Editor

Get Started with Fast Restart