Main Content

Simulink.fault.findFaults

Find faults in model

Since R2023b

Description

example

faults = Simulink.fault.findFaults(model) finds the faults in the model, model. The function returns the faults alphabetically by name. If two or more faults on different model elements have the same name, the function returns those faults alphabetically by model element path.

example

faults = Simulink.fault.findFaults(model,property=value) finds the faults filtered by the Fault object property, property, that match the value, value. The function returns complete and partial matches.

example

faults = Simulink.fault.findFaults(model,property1=value1,...,propertyN=valueN) finds the faults filtered by one or more Fault object property values.

Examples

collapse all

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add two faults to the output port of the Sine Wave block and one fault to the output port of the Constant block.

Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1",Name="myFault1");
Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1",Name="myFault2");
Simulink.fault.addFault(...
"fault_analyzer_intro/Constant/Outport/1",Name="myFault3");

Find the faults in the model.

myFaults = Simulink.fault.findFaults(...
"fault_analyzer_intro");

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add two faults to the output port of the Sine Wave block and one fault to the output port of the Constant block.

Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1",Name="myFault1");
Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1",Name="myFault2");
Simulink.fault.addFault(...
"fault_analyzer_intro/Constant/Outport/1",Name="myFault3");

Find the faults on the Sine Wave block output port.

myFaults = Simulink.fault.findFaults(...
"fault_analyzer_intro",ModelElement="Sine Wave/Outport/1");

Open the sldemo_fuelsys_fault_analyzer model in the Evaluate Fault Combinations on a Fault-Tolerant Fuel System example.

openExample('faultanalyzer/EvaluateFaultsForFuelSystemExample')
model = "sldemo_fuelsys_fault_analyzer";
open_system(model)
fuelSysFaultSetup

Find the faults that have the substring "ego_fault" in their name and have a timed trigger.

myFaults = Simulink.fault.findFaults(...
Name="ego_fault",TriggerType="Timed");

Input Arguments

collapse all

Path or handle to the model, specified as a string scalar, character vector, or model handle.

Data Types: string | char | double

Name of the property, specified as a property of the Fault object. For more information on Fault object properties, see Properties.

Value of the property, specified in the format determined by the property. You can define this argument by using a regular expression.

Output Arguments

collapse all

Faults in the specified model or model element, returned as a Fault object array.

Version History

Introduced in R2023b