Detect Dead Logic Caused by an Incorrect Value
Dead logic detection helps you to identify:
Model design errors.
Extraneous model elements.
Model elements that should be executed, but are not.
In this example, you analyze a fuel rate controller model to determine if the model contains dead logic. Dead logic detection finds the incorrect variable value that causes a transition condition in a Stateflow® chart to remain inactive.
Analyze the Fuel System Model
Open the model.
Ensure that the current folder is writable.
Configure dead logic detection.
On the Design Verifier tab, in the Mode section, select Design Error Detection.
Select 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.
Set Coverage objectives to be analyzed to
Condition Decision. The available options from the drop-down menu are
Condition Decision, and
Click Detect Design Errors.
The results dialog box shows that there are 2/109 objectives that are dead logic.
Review the Results and Trace to the Model
Create an analysis report. From the results inspector window, click HTML.
Scroll to the Dead Logic section. The table lists two instances of dead logic.
In the Description column, one of the dead logic instances is the
press < zero_thresh. The dead logic result indicates that in the simulation, the
falsecondition was not executed. This logic is part of the
Click the Model Item link. Simulink highlights the transition in the chart.
Investigate the Cause of the Dead Logic
The logical statement controlling the transition is
speed==0 & press < zero_thresh
Return to the report. Scroll to the Constraints section.
The value of the input
control logic/Input Data "press"is constrained from 0 through 2. Click the link to open the input in the Model Explorer.
Select the Model Workspace in the Model Explorer. In the contents table, select
zero_thresh. The value of
Given the constrained value of
press, it is always less than
zero_threshand therefore, the
falsecondition is never exercised.
Update the Input Constraint and Reanalyze the Model
Change the value of
Reanalyze the model. On the Design Verifier tab, click Detect Design Errors.
In the new results, the objective is no longer dead logic.