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 (Simulink).

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 Use Simulation Stepper (Simulink).

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);
    

    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. For more information, see Simulink Design Verifier Harness Models (Simulink Design Verifier).

  3. To enable the fast restart mode, click Enable Fast Restart button .

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

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

  5. To add Starting Points, in the Model Slice Manager, 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.

    1. In the Signal Builder block, select Test Case 4.

    2. To simulate the test case, click Start simulation button, .

      Optionally, you can simulate the model by using the Run button in the Simulink® editor. You can also simulate by using the Simulation time window in the Model Slice Manager.

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

      You can simulate a slice for different test case inputs and analyze the dependency analysis.

  7. Debug a slicer simulation by using a simulation stepper. For more information see, Simulation Stepper Access (Simulink).

    1. To debug the simulation for the test case, in the Simulink Editor for the sldvdemo_cruise_control_harness 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 (Simulink). The signal values and the dependencies at T=0.010 appears.

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

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

Related Topics