Specify Fault Properties
When you create faults on Simulink® signals, you can set several properties, including the name and fault behavior. Some properties can be adjusted later by using the Property Inspector.
To specify fault properties for a new fault, edit the properties in the Add Fault window:
Select the signal of interest. In the Fault Analyzer tab, in the Prepare Faults section, click Add Fault.
Click a signal and pause on the ellipsis to open the action bar, and click the Add a fault on the signal button .
To specify fault properties for existing faults, open the Property Inspector by using one of the following approaches:
Click the fault badge on the signal. In the preview window, click the Fault Operations button and click Properties.
Open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table. Expand the model element list. Right-click the fault of interest and click Properties. If the Property Inspector is already open, select the fault from the pane.
To save updates to fault properties, save the model. If you attempt to close the model without saving, Simulink displays a dialog box that allows you to save the fault information file before closing.
Basic Properties
You can adjust these properties in the Basic Properties tab in the Add Fault window or from the Property Inspector unless otherwise specified.
Model element
Specifies the model element that you add the fault to. You can select output or input ports connected to the signal that you selected.
You can only adjust this property in the Add Fault window.
Fault name
Specify the name of the fault. You must enter a name that follows the naming conventions for blocks in Simulink.
Fault information directory
Specifies where to save the fault information XML file. This property appears only if the Save fault information property is selected. If the Fault information directory property is cleared, the software saves the XML file in the current working directory. After you create the XML file for a model, you cannot create a new file for the model. If you change the directory, save the file to a directory on path.
This property appears only in the Add Fault window.
Add fault behavior
Select to enable properties that allow you to add fault behavior to the fault. In the Add Fault window, select this property to enable the Select fault behavior, Add fault behavior to, Fault model directory, Name, and Trigger Type properties. If you clear the Add fault behavior property then click OK, the new fault does not have an associated fault behavior.
If you create a fault that does not have behavior, access the fault properties in the Property Inspector. Click Add fault behavior to open the Add Fault Behavior window.
Fault library
Specify the fault library. You can select the built-in library,
mwfaultlib
, or a custom library that contains fault behaviors
that you create. You must register the custom fault behavior. See Customize Fault Behaviors by Using Libraries.
Fault behavior
Specify the fault behavior. You can adjust this property if Add fault behavior has been selected in the Add Fault window, or if the existing fault does not have behavior and you click Add fault behavior in the Property Inspector. If you select the default library, you can select these options:
Value | Description |
---|---|
Custom fault behavior | Creates an empty subsystem that you can customize to model desired fault behavior when the fault triggers. Other faults cannot access this fault behavior. |
Absolute Value | Sets the signal value to its absolute value when the fault triggers. |
Add Noise | Adds noise to the signal when the fault triggers. |
Gain | Adds a gain to the signal when the fault triggers. |
Negate Value | Multiplies the signal by -1 when the fault
triggers. |
Offset-by-1 | Subtracts -1 from the signal when the
fault triggers. |
Stuck-at-Constant | Sets the signal to a constant value when the fault triggers.
The default value is 1 . |
Stuck-at-Ground | Sets the signal to zero when the fault triggers. |
Unit Delay | Applies a unit delay to the signal when the fault triggers. |
To open the Fault Subsystem block that models the fault behavior, open the Property Inspector, select a fault from Select fault to view, and click the hyperlink next to Fault Behavior. After you create a fault with behavior, you can edit the assigned behavior.
Faults can inject their behavior into your model only when they are active. A model element can have only one active fault. You can set active faults in the Fault Table pane or the Property Inspector.
To delete a fault behavior, use the deleteBehavior
function.
If the fault library that you select is a registered custom library, the selection includes the Fault Subsystem blocks included in the library. For more information, see Create Predefined and Custom Fault Behaviors.
Add Fault Data Inport block to behavior
Adds a Fault
Data Inport to the fault behavior. You can enable this property only if
you select Custom fault behavior
in the Fault
behavior property.
Add fault behavior to
Specify the model in which to store the fault behavior. This model is the fault
model. You can select an existing fault model or select New fault
model
to create a new model.
After you assign a fault behavior and fault model to a fault, you cannot change the assigned fault model.
Fault model directory
Specifies where to save the fault model. This property appears only when you
select the Add fault behavior property and set the
Add fault behavior to property to New fault
model
. If the Fault model directory property
is empty, the software saves the model in the current working directory. If you
specify a directory, you must specify a directory on the path.
Name
Specify the name of the fault model. This property appears only if you select the
Add fault behavior property and set the Add fault
behavior to property to New fault model
.
Enter a name that follows the naming conventions in Simulink. By default, the Name property is the name of the
model appended with _FaultModel
. For example, for a model named
myModel
, the default Name property is
myModel_FaultModel
.
Trigger type
Specify the conditions that must be met for Simulink Fault Analyzer™ to inject the fault behavior to the model. This property appears only if the Add fault behavior property is selected. The trigger only applies to enabled faults. You can these options:
Trigger type | Description |
---|---|
Always
On | The fault is injected at the start of simulation. |
Timed | The fault is injected when the simulation reaches a specified simulation time. The value must be a real scalar. |
Conditional | The fault is injected as a result of a specified conditional. See Create and Manage Conditionals. |
Manual (since R2024a) | You control the injection status in the Fault
Dashboard pane. See Manually Trigger Faults in Models. In the Fault Analyzer tab, in the
View section, click Fault
Dashboard. You can also control the injection status
by changing the TriggerActive value of the Fault object. |
Behavioral | The fault injects as a result of a fault parameter value during simulation. You can specify this trigger type only for faults on Simscape™ blocks. |
Trigger fault at time
This property applies only when the Trigger type property is
Timed
.
Specify the simulation time when the fault is injected.
Select conditional from model
This property applies only when the Trigger type property is
Conditional
.
Specify the conditional that you use to trigger the fault. See Create and Manage Conditionals.
Trigger stays on once activated
This property applies only when the Trigger type property is
Conditional
.
Specify whether the fault trigger is irreversible or not. When this property is enabled, the fault is injected when the conditional first satisfies, then stays injected until the simulation ends. When this property is disabled, the fault is injected only when the conditional expression is satisfied.
On
This property applies only when the Trigger type property is
Manual
.
Specify whether the fault is injected or not.
Description
Add a description to a fault. View this property in the Description tab of the Add Fault window or at the bottom of the Property Inspector.
Fault Selection Properties
Before simulating faults, you must activate a fault and enable the corresponding model element for fault injection. See Enable, Modify, and Select Active Faults. To see the properties that enable model elements and activate faults, in the Fault Analyzer tab, in the View section, click Fault Table. You can also view these properties in the Property Inspector. You can modify these properties only after you create the fault.
Enable
Specify whether faults on the model element are enabled. In the Property Inspector, select the Enable property. In the Fault Table pane, set this property in the Enable column for the model element.
Active fault for simulation
Specify the active fault for the model element. This property lists only the faults associated with the selected model element. You can specify only one active fault for each enabled model element. In the Property Inspector, this property displays after the Enable property is selected. In the Fault Table pane, set this property in the Active Fault column.
Programmatically Specify Fault Properties
You can specify fault properties programmatically by retrieving the Fault
object of the fault and adjusting the object properties. For more
information, see Add and Configure Faults Programmatically.