Main Content

Introduction to Simscape Faults

You can use faults in Simscape to identify potential failures and analyze their effects on the system performance and behavior. You can predict and evaluate their impacts on the system functionality, reliability, and safety before they occur. You can add faults from the block dialog or the MATLAB Command Window, then specify when the faults trigger.

Fault Terminology

Some of the terminology to describe the fault process is specific to Simscape fault modeling:

  • Model element — Any part of your model that can support a fault, such as a block.

  • Subelement — The one or more independent components that support faults for a given model element. For example, you can add a fault to the armature windings, the series field windings, or the shunt field windings of the Compound Motor block.

  • Fault trigger — A value that switches from false to true when the simulation reaches a fault condition.

  • Fault configuration — The fault parameterization for a given block that contains information about the model element or subelements, the fault behavior, and the fault trigger.

  • Fault scenario — The collection of faults that are enable during the simulation.

  • Fault information file — The XML file associated with the fault parameter data for each fault.

  • Fault model file — The SLX file associated with each model element that contains the fault parameterizations. This file is separate from the model file.

Add Faults to a Block

To add the first fault to a block from the block dialog box, in the Faults section, click the Add fault hyperlink for the fault that you want to add. Some blocks supports multiple faults, and some faults are dependent on parameter settings. To learn which blocks support faults, see Blocks that Support Fault Modeling.

Blocks that support faults have a Faults section in the Simscape Block tab.

Faults section of Simscape Block tab, where the button on the left indicates that fault simulation is on.

When you create a fault, you give it a name and specify the trigger type. You can also add a description that is visible in the Fault Table.

You parameterize the fault using the Property Inspector

To learn more, see Analyze a DC Armature Winding Fault.

Set Fault Triggers

You can use fault triggers to specify when faults occur in your Simscape blocks. You can configure faults to trigger based on time, conditions, behavior, or to be on during the entire simulation. To configure fault triggers, open the Create Fault window. In the block dialog box, click the hyperlink under the Faults section. Then, use the Trigger Type parameter to specify the trigger. Simscape faults supports these triggers:

  • Always On — The fault injects at the start of simulation.

  • Timed — The fault injects when the simulation reaches the time in the Trigger fault at time property. The value must be a real scalar.

  • Conditional — The fault injects as a result of a condition that reflects a behavior associated with a signal. Conditionals evaluate the Boolean expression in the Condition parameter at each time step. To learn more, see Create and Manage Conditionals.

  • Behavioral — The fault injects as a result of a fault parameter value during simulation. Setting Trigger type to Behavioral enables parameters for you to specify the value when the fault triggers.

View Faults in the Fault Table

To view all faults in a model, open the Fault Table. Click a block that has a fault and, in the Simscape Block tab, click Fault Table. Each fault that you create appears in this table. From the Fault Table pane, you can enable or disable fault simulation for a specific fault, all the faults in a block, or for the Simscape model.

Fault Table shows all faults in the model including which one is active. Here the model, DC Motor block, and the DCMotor_fault_1 fault is selected.

View Fault Behavior in Simscape Code

When a block supports faults, the source code for the block contains the definition of the fault behavior. Open the source code to view the behavior.

Using Fault Model Files

When you add a fault to a model, the fault information is stored in the fault model file. When you make changes to a fault, these changes do not impact the base Simscape model. You can erase all fault information in the model by deleting the fault model file.

See Also