Main Content

Simulink.fault.isEnabled

Determine whether model elements are enabled for fault injection

Since R2023b

Description

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

example

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");

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 element with them same index in the modelElements input argument.

Version History

Introduced in R2023b