Main Content

Define Trigger Properties

This example shows how to specify triggers. After you create faults and assign behaviors to them, you can specify how and when each fault is injected. Although you can select more than one fault for simulation, you can select only one active fault on each model element. See Define and Model Faults.

Video Walkthrough

For a walkthrough of the example, play the video.

After you create faults and assign behaviors to them, you can specify how and when each fault is injected. Although you can simulate a model that contains more than one fault, you can select only one active fault on each model element. To start, open the example model and set up the faults by entering these commands.

The model contains faults on each input signal of the two controller subsystem. The throttle signal contains two faults, and the other signals contain one fault. In this example, define the trigger properties so the fault on the throttle signal, named throttle fault, and the fault on the speed signal inject after 25 seconds of simulation time.

To start, click the Fault Badge on the throttle signal. In the preview window, click the Fault Operations button and click Properties. The property inspector opens and displays the fault properties. When you create faults, you can specify how and when they inject by specifying the trigger. When the trigger is true, the fault is injected.

In the trigger section, set the trigger type property to Timed and set the trigger fault at time property to 25. Go ahead and repeat these steps for the fault on the speed signal.

You can also create conditional triggers based on expressions or the values of model elements. For more information, see the Create and Manage Conditionals topic in the Simulink Fault Analyzer documentation.

After specifying the properties of the faults, you must select which faults to inject during simulation by enabling a model element that has faults and selecting the active fault. You can select only one active fault on each model element for fault simulation. In this example, enable the faults on the throttle signal. Disable the faults on the other model elements. And select Throttle Fault as the active fault.

First, open the fault table pane. In the Fault Analyzer tab, in the View section, click Fault Table. Then enable the first input port for the two-controller subsystem for fault injection. Next, expand the list for the first input port to the two-controller subsystem, and select Throttle Fault as the active fault. Next, disable the faults on the other model elements. Finally, ensure that fault simulation is on. This button is green when the fault simulation is enabled.

After making these changes, save the fault information file. In the Fault Analyzer tab, in the File section, expand Save All, and click Save Fault Information File. In the next step, you simulate faults by using the interface and creating scripts to run multiple simulations and then view the fault simulation results.

To learn more about this process, see the Run Fault Simulations and View Results topic in the Simulink Fault Analyzer documentation.

Video Player is loading.
Current Time 0:00
Duration 3:07
Loaded: 0%
Stream Type LIVE
Remaining Time 3:07
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected

    Specify Fault Triggers

    When you create faults, you can specify how and when they inject by specifying the trigger. When the trigger is true, the fault is injected. For more information on the triggers you can select, see Trigger type.

    Open the sldemo_fuelsys_fault_analyzer model and set up the faults with the helper function, myFuelSysCase. The helper function deletes the existing Simulink® Fault Analyzer™ model artifacts and replaces them with the faults used in the example.

    myFuelSysCase(3)

    After executing the function, the model contains faults on each input signal of the To Controller subsystem. The throttle signal contains two faults and the other signals contain one fault. In this example, you define the trigger properties so the fault on the throttle signal named throttle_fault and the fault on the speed signal are injected after 25 seconds of simulation time.

    Click the fault badge on the throttle signal. In the throttle_fault preview window, click the Fault Operations button and click Properties.

    The image shows a portion of the example model, close to the To Controller subsystem. The cursor points to a context menu that displays after you click the fault operations icon in the fault preview window. The cursor points to the Properties option from the menu.

    The Property Inspector displays the properties. In the Trigger section, set the Trigger type property to Timed. Set the Trigger fault at time property to 25.

    The Property Inspector displays the properties for the fault, throttle fault. The Trigger type property is set to Timed, and the Trigger fault at time property is set to 25.

    Repeat these steps for the fault on the speed signal. You can also create conditional triggers based on expressions or the values of model elements. For more information, see Create and Manage Conditionals.

    Select Faults and Prepare for Simulation

    After specifying the properties of the faults, you must select which faults are injected during simulation by enabling a model element that has faults and selecting the active fault. You can select only one active fault on each model element for fault simulation. In this example, use the Fault Table pane to enable faults on the throttle signal, disable faults on the other model elements, and select throttle_fault as the active fault.

    1. Open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.

    2. Enable the first input port for the To Controller subsystem for fault injection. In the Enable column, select the check box for the model element To Controller/Inport/1.

    3. Expand the list for the To Controller/Inport/1 model element.

    4. Select throttle_fault as the active fault on the first input port of the To Controller subsystem. In the Active Fault column, select the check box for throttle_fault. Activating throttle_fault disables the other fault, throttle_fault_custom.

    5. Enable fault simulation. In the Fault Table pane, click the turn on/off simulation of faults button. The icon is green when fault simulation is enabled.

    The Fault Table pane for the model. The first input port model element menu is expanded and enabled. throttle_fault is set to the active fault, while throttle_fault_custom is not active. The other model elements are not enabled, and their check boxes in the Enable column are cleared.

    Save the fault information file and the model. In the Fault Analyzer tab, in the File section, click Save All.

    See Also

    Topics