Main Content

Simulink.fault.injection

Enable fault simulation for model

Since R2023b

Description

isOn = Simulink.fault.injection(model) returns 1 if the model model has fault simulation turned on.

example

isOn = Simulink.fault.injection(model,status) turns fault simulation on or off based on the value of status.

example

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Check if fault simulation is turned on for the model.

status = Simulink.fault.injection("SimpleMotorArmatureWindingFault");

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Turn on fault simulation.

status = Simulink.fault.injection(...
"SimpleMotorArmatureWindingFault",true);

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

Fault simulation status, specified as a numeric or logical 1 (true) or 0 (false). Enter 1 or true to turn on fault simulation.

Data Types: logical

Output Arguments

collapse all

Previous fault simulation status of the model, returned as a 1 or 0 of data type logical.

Version History

Introduced in R2023b