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.
sldvoptionsparameters 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_harnessand saves it in the default location
<current_folder>\sldv_output\sldvdemo_cruise_control\sldvdemo_cruise_control_harness.slx. For more information, see Manage Simulink Design Verifier Harness Models (Simulink Design Verifier).
To enable the fast restart mode, click Enable Fast Restart button .
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 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.
To add Starting Points, in the Model Slicer, click Add all outports..
targetoutports are added as the Starting Points.
You can simulate a test case and analyze the highlighted dependencies in the slice.
In the Signal Builder block, select
Test Case 4.
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 Slicer.
The slice shows the highlighted dependencies for the
Test Case 4inputs.
You can simulate a slice for different test case inputs and analyze the dependency analysis.
Debug a slicer simulation by using a simulation stepper. For more information see, Step Through Simulation.
To debug the simulation for the test case, in the Simulink Editor for the
sldvdemo_cruise_control_harnessmodel, 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
To debug the slice at
T=0.030, step forward and view the signal values and the highlighted slice.
To complete the simulation stepping, click the Run button.