Before you simulate a model, use dead logic detection to analyze the model for dead logic. In Simulink® Design Verifier™, design error detection for dead logic consists of two analysis options:
Dead logic (partial): If you select this option, Simulink Design Verifier analyzes your model without making any approximations, such as rational approximation for floating points, or while loop approximation. For more information, see Approximations. With this option, Simulink Design Verifier does not report active logic or undecided objectives and it may not identify some dead logic in your model.
This option is available in:
The Model Advisor. See Check For Design Errors using the Model Advisor.
The Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane.
Run exhaustive analysis: With this option, Simulink Design Verifier reports active logic in addition to dead logic as well as undecided objectives. This option may in some cases identify or find additional dead logic. The analysis may use approximations and are reported accordingly.
This option is available in the Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane.
If you are not using the Model Advisor, to detect dead logic:
On the Design Verifier tab, in the Mode section, select Design Error Detection.
Click Error Detection Settings.
In the Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane:
Enable the Dead logic (partial) option.
Clear the Run exhaustive analysis option, if it is selected.
To apply these settings, click OK and close the Configuration Parameters dialog box.
Click Detect Design Errors.
On the Design Verifier tab, in the Mode section, select Design Error Detection.
Click Error Detection Settings.
In the Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane, enable the Dead logic (partial) and Run exhaustive analysis options.
To apply these settings, click OK and close the Configuration Parameters dialog box.
Click Detect Design Errors.
This example shows how to detect dead logic in the
sldvSlicerdemo_dead_logic
example model. Dead logic detection
finds the unreachable objectives in the model that cause the model element to remain
inactive.
Open the sldvSlicerdemo_dead_logic
model.
open_system('sldvSlicerdemo_dead_logic');
On the Design Verifier tab, in the Mode section, select Design Error Detection.
Click Error Detection Settings.
In the Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane, enable Dead logic (partial) option and clear Run exhaustive analysis option.
Click Detect Design Errors.
The software analyzes the model for dead logic and displays the results in the Results
Summary window. The result indicates that seven of the 24
objectives were found to be dead logic.
Click Highlight analysis results on model. The dead logic model elements are highlighted in red.
Open the Controller
subsystem, and click the OR block highlighted
in red. The Result Inspector displays the summary of the dead logic.
The set
input is equal to 1
, so the
input port 1
of the OR block
can only be true. The status implies that the
input port 1
false condition is dead logic.
Similarly, the input port 2
is
unreachable
, as the objective never executes and is
dead logic.
To view the detailed analysis report, in the Results Summary window, click HTML.
The report displays the summary of all the results that are dead logic in the model.
Dead Logic
The software stores the detailed analysis results in the
DeadLogic field
in the Simulink Design Verifier Data Files. You can use the data file for further
analysis of the results.