Main Content

Inspect Model and Add Simulink Fault Analyzer Faults

If you have a model that uses blocks to model faults and their behaviors, these model artifacts can obscure the normal model behavior or limit fault modeling capabilities. If you have Simulink® Fault Analyzer™, you can include faults that inject behavior without requiring changes to the model design.

In Simulink Fault Analyzer, fault modeling is the creation and configuration of faults and their behaviors, and fault injection is the process by which a fault introduces its behavior into a model. Consequentially, you model faults that can inject during simulation.

In this example, you inspect a model of a control system, remove the intrusive blocks that represent the faults, and add nonintrusive faults by using Simulink Fault Analyzer.

Video Walkthrough

For a walkthrough of the example, play the video.

Open the Sample Model

This example models a fault-tolerant fuel control system. For more information on the physical system, see Model Fault-Tolerant Fuel Control System. In this example, each of the four inputs to the controller has a fault. Each fault uses a combination of Constant and Switch blocks to model the behavior. If the fault is injected, the model overrides the input signal with a constant value to represent the activated fault. This practice is common in automotive applications where the faults have this kind of behavior. Open the model, sldemo_fuelsys, to view the design.


The original control system model, sldemo_fuelsys. The model contains four faults. Each fault uses Constant blocks and Switch blocks to model the fault behavior.

Remove the Faults

To model the faults with Simulink Fault Analyzer, identify the artifacts that represent the faults.

The original control system model, sldemo_fuelsys. The model has a red box around the faults.

Remove these blocks and reconnect the signals.

The updated control system model. The model does not contain any faults. The blocks from the previous model are removed.

In addition to better representing the design, this modification also simplifies the model.

The faults in this example rely on a dashboard to control their injection. However, when you add faults to a model by using Simulink Fault Analyzer, you control the faults by using Simulink Fault Analyzer directly. Consequentially, the switches in the dashboard are unnecessary. From the model, open the Dashboard block to view the switches. The Fault Injection panel controls the fault injection.

The inside of the Dashboard block. The Fault Injection panel is enclosed in a red box, highlighting where the switches that control the faults are.

Remove the Fault Injection panel.

The inside of the Dashboard block after removing the dead switches and deleting the Fault Injection panel. The Inputs panel takes up the remaining space.

Add Faults to Model

After cleaning the model, you can add faults to the inputs of the To Controller block. For more information on adding and modeling faults, see Define and Model Faults.

  1. Open the Fault Analyzer app. In the Apps tab, in the Apps section, click Fault Analyzer.

  2. Select the throttle signal. In the Fault Analyzer tab, in the Prepare Faults section, click Add Fault.

    In the mode. The throttle signal is selected, and the cursor points to the Add Fault button in the Prepare Faults section of the Fault Analyzer app.

  3. In the Add Fault window, select the model element and the behavior. Set the Model element property to sldemo_fuelsys/To Controller/Inport/1 and select Add fault behavior. In the Fault Library property, select the built-in library, mwfaultlib. This library contains several example behaviors. See Fault library. Set the Fault behavior property to Stuck-at-Ground.

    The Add Fault window with the required settings. To model element is the first input port of the To Controller subsystem. The add fault behavior is selected and the Fault behavior property is set to Stuck-at-Ground.

  4. Click OK. The fault badge displays by the signal.

    The input signals of the To Controller block after you add the fault. The fault badge, representing a zigzag line, is next to the throttle signal that goes into To Controller.

  5. Repeat steps 2–4 for the speed, and map signals that go into To Controller. For the ego signal, select Stuck-at-Constant for Fault behavior instead.

    The input signals of the To Controller block after you add the remaining three faults. A fault badge, representing a zigzag line, is next to the output of each convert block on the speed, ego, and map signals.

Adjust the Fault Behavior

In the previous version of the model, the fault on the ego signal overrode the signal with a value of 12. Modify the fault behavior of the fault on the ego signal to match the previous behavior.

  1. Open the fault model, which contains the model of the fault behavior. Click the fault badge on the ego signal and click the ego_fault preview window.

    The view of the model block after clicking on the fault badge and pointing to the preview window.

  2. The fault model opens, and displays the Fault Subsystem block that models the fault behavior. When the fault is injected, the fault replaces the signal value with the value of the Constant block.

    The fault behavior that models the fault on the ego signal. A constant block with a zero in the center exits.

    In this example set the Constant value parameter of the Constant block to 12 and click OK.

  3. Save and exit the fault model.

The new faults now have the same behavior as the previous version of the model, and you control when they are injected. If the fault is not injected, the fault does not modify the signal.

Save the model or save the fault information file and fault model by clicking Save All in the Fault Analyzer tab. (since R2024a)

Next, you create a fault with custom behavior. Click Next at the bottom of this page to continue.

Related Topics