Main Content

simscape.addFaultsToBlock

Add faults to blocks

Since R2023b

    Description

    simscape.addFaultsToBlock(blockPath) adds a fault to a block specified by blockPath. The function adds a fault to each fault-capable element, including the elements of the subcomponents and subcomponent arrays.

    example

    simscape.addFaultsToBlock(blockPath,element) adds a fault to a block filtered by the fault element element. The faults have default names, parameters, and triggers. The faults are deactivated. Use the element argument to add elements of a specific type.

    Examples

    collapse all

    This example shows how to add a faults to a block with multiple fault-capable elements. The Compound Motor block contains multiple fault-capable elements. To add a deactivated, default fault to each element of a Compound Motor block in a model named myModel, enter:

    simscape.addFaultsToBlock('myModel/Compound Motor')

    You can check the status of the fault in the Fault Table pane or the Property Inspector.

    This example shows how to add a fault to a specific element of a block with multiple fault-capable elements. The Compound Motor block contains the Armature winding fault element. To add a deactivated, default fault to the Armature winding element of a Compound Motor block in a model named myModel, enter:

    simscape.addFaultsToBlock('myModel/Compound Motor',Element='Armature winding')

    You can check the status of the fault in the Fault Table pane or the Property Inspector. To programmatically retrieve the fault, use the Simulink.fault.findFaults functions.

    Input Arguments

    collapse all

    Fault-capable block path or block handle, specified as a string scalar or character vector. If you input a composite component that contains subcomponents with fault-capable elements, the function adds a fault to each element.

    Data Types: char | string

    Fault element names, specified as a string scalar or character vector. To only add faults to a certain type of fault element, specify that element as the value.

    Data Types: char | string

    Version History

    Introduced in R2023b