Main Content

Simulink.fault.isEnabled

Determine whether model elements are enabled for fault injection

Since R2023b

Description

example

status = Simulink.fault.isEnabled(modelElements) returns if the model elements, modelElements, are enabled for fault injection.

Examples

collapse all

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add a fault to the Sine Wave block output port.

myFault = Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1");

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

addBehavior(myFault,"myBehaviorModel",...
FaultBehavior="mwfaultlib/Add Noise");

Check if the Sine Wave block output port is enabled for fault simulation.

enabledStatus = Simulink.fault.isEnabled(...
"fault_analyzer_intro/Sine Wave/Outport/1");

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.

In Simulink® models, each entry in the array must be the path or handle of a block output or input port. In Simscape™ blocks, each entry in the array must be the path of a fault-capable model subelement. In System Composer™ models, each entry in the array must be the path to a component output or input port.

Example: "myModel/Sine Wave/Outport/1"

Example: ["myModel/Sine Wave/Outport/1" "myModel/Gain/Outport/1"]

Example: {'myModel/Sine Wave/Outport/1', 'myModel/Gain/Outport/1'}

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 associated entry in the input argument, modelElements of the same index.

Version History

Introduced in R2023b