Main Content

getTriggeredFaults

Return array of faults triggered by conditional

Since R2023b

Description

fault = getTriggeredFaults(conditional) returns the faults that use the conditional conditional as the trigger.

example

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Add a fault called myFault to the Armature winding model subelement of the DC Motor block.

myFault = Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding",...
Name="myFault");

Add an empty behavior to the fault.

addBehavior(myFault,"myBehaviorModel");

Define the TriggerType property for the fault object.

myFault.TriggerType = "Conditional";

Add a conditional named myConditional to the model, and specify the condition expression as y1 >= 0.

faultConditional = Simulink.fault.addConditional(...
"SimpleMotorArmatureWindingFault","myConditional","y1 >= 0");

Define the Conditional property of the fault object.

myFault.Conditional = faultConditional;

Find the conditional in the model.

faultConditional = Simulink.fault.findConditionals(...
"SimpleMotorArmatureWindingFault")
faultConditional = 

  Conditional with properties:

           Name: 'SampleConditional'
      Condition: 'x == true'
    LogActivity: 0

Find the fault that uses the conditional.

myFault = getTriggeredFaults(faultConditional)
myFault = 

  Fault with properties:

            Name: 'myFault'
     Description: ''
    ModelElement: 'SimpleMotorArmatureWindingFault/DC Motor/Armature winding'
            Type: 'Simscape'
        IsActive: 1
     TriggerType: 'Conditional'
      Persistent: 1
     Conditional: [1×1 Simulink.fault.Conditional]

Input Arguments

collapse all

Conditional assigned to the faults in a model, specified as a Conditional object.

Output Arguments

collapse all

Faults in the model that use the conditional as a trigger, returned as a Fault object array.

Version History

Introduced in R2023b