Main Content

Simulink.fault.isEnabled

Determine whether model elements are enabled for fault injection

Since R2023b

Description

example

status = Simulink.fault.isEnabled(modelElements) returns true for each model element in modelElements that is enabled for fault injection.

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Add a fault to the Armature winding model subelement in the DC Motorblock.

Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding");

Assign behavior to the fault and store the behavior in a fault model named myBehaviorModel on the path.

addBehavior(myFault,"myBehaviorModel")

Check if the armature winding is enabled for faults.

enabledStatus = Simulink.fault.isEnabled(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding");

Input Arguments

collapse all

Paths or handles of model elements, specified as a string array, cell array of character vectors, or a vector of handles. If you specify only one model element, enter it as a scalar.

Each entry in the array must be the path of a fault-capable model subelement.

Example: "myModel/DC Motor/Armature winding"

Example: ["myModel/DC Motor/Armature winding" "myModel/RC Servo/Servo"]

Example: ['myModel/DC Motor/Armature winding', 'myModel/RC Servo/Servo']

Data Types: string | char | double

Output Arguments

collapse all

Whether the model elements are enabled, returned as a 1 or 0 of data type logical. Each value corresponds to the element with them same index in the modelElements input argument.

Version History

Introduced in R2023b