Inspect Model and Add Simulink Fault Analyzer Faults
If you have a model that uses blocks to model faults and their behaviors, these model artifacts can obscure the normal model behavior or limit fault modeling capabilities. If you have Simulink® Fault Analyzer™, you can include faults that inject behavior without requiring changes to the model design.
In Simulink Fault Analyzer, fault modeling is the creation and configuration of faults and their behaviors, and fault injection is the process by which a fault introduces its behavior into a model. Consequentially, you model faults that can inject during simulation.
In this example, you inspect a model of a control system, remove the intrusive blocks that represent the faults, and add nonintrusive faults by using Simulink Fault Analyzer.
Video Walkthrough
For a walkthrough of the example, play the video.
Open the Sample Model
This example models a fault-tolerant fuel control system. For more information on the
physical system, see Model Fault-Tolerant Fuel Control System. In this example, each of the
four inputs to the controller has a fault. Each fault uses a combination of
Constant and Switch blocks to model the behavior. If
the fault is injected, the model overrides the input signal with a constant value to
represent the activated fault. This practice is common in automotive applications where
the faults have this kind of behavior. Open the model,
sldemo_fuelsys
, to view the design.
openExample(... 'simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample')
Remove the Faults
To model the faults with Simulink Fault Analyzer, identify the artifacts that represent the faults.
Remove these blocks and reconnect the signals.
In addition to better representing the design, this modification also simplifies the model.
The faults in this example rely on a dashboard to control their injection. However,
when you add faults to a model by using Simulink
Fault Analyzer, you control the faults by using Simulink
Fault Analyzer directly. Consequentially, the switches in the dashboard are unnecessary.
From the model, open the Dashboard
block to view the switches. The
Fault Injection panel controls the fault injection.
Remove the Fault Injection panel.
Add Faults to Model
After cleaning the model, you can add faults to the inputs of the To
Controller
block. For more information on adding and modeling faults, see
Define and Model Faults.
Open the Fault Analyzer app. In the Apps tab, in the Apps section, click Fault Analyzer.
Select the
throttle
signal. In the Fault Analyzer tab, in the Prepare Faults section, click Add Fault.In the Add Fault window, select the model element and the behavior. Set the Model element property to
sldemo_fuelsys/To Controller/Inport/1
and select Add fault behavior. In the Fault library property, select the built-in library,mwfaultlib
. This library contains several example behaviors. See Fault library. Set the Fault behavior property toStuck-at-Ground
.Click OK. The fault badge displays by the signal.
Repeat steps
2–4
for thespeed
, andmap
signals that go intoTo Controller
. For theego
signal, selectStuck-at-Constant
for Fault behavior instead.
Adjust the Fault Behavior
In the previous version of the model, the fault on the ego
signal overrode the signal with a value of 12
. Modify the fault
behavior of the fault on the ego
signal to match the previous
behavior.
Open the fault model, which contains the model of the fault behavior. Click the fault badge on the
ego
signal and click the ego_fault preview window.The fault model opens, and displays the Fault Subsystem block that models the fault behavior. When the fault is injected, the fault replaces the signal value with the value of the Constant block.
In this example set the Constant value parameter of the Constant block to
12
and click OK.Save and exit the fault model.
The new faults now have the same behavior as the previous version of the model, and you control when they are injected. If the fault is not injected, the fault does not modify the signal.
Save the model or save the fault information file and fault model by clicking Save All in the Fault Analyzer tab. (since R2024a)
Next, you create a fault with custom behavior. Click Next at the bottom of this page to continue.