Main Content

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

1. Open the model.

open_system('sldvdemo_fuelsys_logic_simple')

Ensure that the current folder is writable.

2. Configure dead logic detection.

On the Design Verifier tab, in the Mode section, select Design Error Detection.

3. Select Error Detection Settings.

4.In the Configuration Parameters dialog box, on the Design Verifier > Design Error Detection pane:

  1. Enable the Dead logic (partial) option.

  2. Clear the Run exhaustive analysis option, if it is selected.

  3. Set Coverage objectives to be analyzed to Condition Decision. The available options from the drop-down menu are Decision, Condition Decision, and MCDC.

5. Click Detect Design Errors.

6. The results dialog box shows that there are 2/109 objectives that are dead logic.

dead_logic_ri_results.png

Review the Results and Trace to the Model

1. Create an analysis report. From the results inspector window, click HTML.

2. Scroll to the Dead Logic section. The table lists two instances of dead logic.

3. In the Description column, one of the dead logic instances is the false condition of press < zero_thresh. The dead logic result indicates that in the simulation, the false condition was not executed. This logic is part of the Sens_Failure_Counter.INC transition.

4. Click the Model Item link. Simulink highlights the transition in the chart.

dead_logic_sldvdemo.png

Investigate the Cause of the Dead Logic

1. The logical statement controlling the transition is:

speed==0 & press < zero_thresh

2. Return to the report. Scroll to the Constraints section.

3. 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.

4. Select the Model Workspace in the Model Explorer. In the contents table, select zero_thresh. The value of zero_thresh is 250.

Given the constrained value of press, it is always less than zero_thresh and therefore, the false condition is never exercised.

Update the Input Constraint and Reanalyze the Model

1. Change the value of zero_thresh to 0.250.

2. Reanalyze the model. On the Design Verifier tab, click Detect Design Errors.

3. In the new results, the objective is no longer dead logic.

See Also

Dead Logic Detection