Contenido principal

Add Fault Behaviors to Buses

You can create fault behaviors that affect one or multiple elements of the bus. You can add a fault behavior that affects one element, several elements, or all elements in the bus.

Add Fault Behavior that Affects One Bus Element

Since R2026a

To create a fault and add fault behavior that affects one bus element:

  1. In your model, select the bus.

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

  3. In the Add Fault window, set the Fault library property, then set the Fault behavior property to the behavior you want to model. Bus elements support fault behaviors in the default fault library, mwfaultlib, and custom fault behaviors that you specify in other libraries. However, if you assign fault behavior from a custom library, Simulink® Fault Analyzer™ creates an unlinked copy of the fault behavior. For more information on adding behaviors to faults, see Create Predefined and Custom Fault Behaviors.

  4. Specify the bus element. Select the Fault specific bus element property and set the Bus element property to the bus element.

    The Add Fault window. The section of the window shows that the Add fault behavior property is specified and the Fault Specific Bus Element property is enabled below it. The Bus Element property has a bus named Step selected.

  5. Click OK.

To add fault behavior that affects one bus element to an existing fault:

  1. Click the fault badge next to the bus.

  2. Click the Add fault behavior icon in the preview window.

  3. In the Add Fault Behavior window, set the Fault library property, then set the Fault behavior property to the behavior you want to model.

  4. Specify the bus element. Select the Fault specific bus element property and set the Bus element property to the bus element.

    The Add Fault Behavior window. The section of the window shows that the Add fault behavior property is specified and the Fault Specific Bus Element property is enabled below it. The Bus Element property has a bus named NestedBus selected.

  5. Click OK.

The fault behavior affects only the specified bus element. To view the fault behavior, click on the fault badge and click the preview window. The behavior uses a Bus Selector block to retrieve the bus element, applies the fault behavior, and assigns the updated signal to the bus by using a Bus Assignment block. This image shows fault behavior that adds noise to only the Step bus element.

A fault behavior. The signal from the Fault Inport block enters a bus selector, which selects the Step element. The signal from the bus element enters a Sum block, along with a signal from a White Noise block. The output of the Sum block enters a Bus Assignment block, which is used to override the

Note

If the bus or one of the bus elements is a virtual bus, simulating the fault produces an error during model compilation. See Simulate Faults on Nonvirtual Buses.

Programmatically Add Behavior that Affects One Bus Element

To programmatically add fault behavior to a bus element, retrieve the Fault object from the fault, use addBehavior function, and specify the BusElement name-value argument.

Add Fault Behavior that Affects Multiple Bus Elements

You can define behaviors for individual bus elements, or apply the behavior that affects the entire bus.

Define Fault Behaviors for Individual Bus Elements

To define fault behaviors for individual bus elements:

  1. Add fault behavior to the fault.

  2. Update the model. The fault behavior registers the fault.

  3. Open the fault behavior. In your model, click on the fault badge and click the preview window.

  4. Split the signal from the Fault Inport block by using a Bus Selector block and select the bus elements to output.

  5. Add blocks to model the fault behavior for each of the bus elements.

  6. Reassign the bus elements to the bus by using a Bus Assignment block.

For example, this fault behavior selects three bus elements from a bus, applies a distinct offset to each bus element, and assigns the updated values to the bus by using a Bus Assignment block.

An example fault behavior. The Bus Selector block outputs three elements. Each one is passed through a Bias block, and the signals are then recombined into a Bus Assignment block.

The bus elements of the input ports to the Bus Assignment block must match the bus elements output by the Bus Selector block.

Add a Fault Behavior that Affects All Bus Elements

To add a fault behavior that affects all the bus elements, the blocks in the fault behavior must support buses. See Bus-Capable Blocks. Consequentially, if you want to use behaviors in the default behavior library mwfaultlib, you can only use the stuck-at-ground fault behavior.

See Also

Topics