Link Faults to Linkable Items
If you have a Requirements Toolbox™ license, you can define the traceability between faults and other artifacts by linking the faults to linkable items in Simulink® and other external programs. Linkable items in Simulink include requirements, test cases, and spreadsheet cells and rows in the Safety Analysis Manager. For a list of linkable items, see Linkable Items (Requirements Toolbox).
When you link faults, the Requirements Toolbox software stores the links in a SLMX file by default.
Link Faults to Requirements
Link faults to requirements to specify the safety requirements for your design. After linking, you can configure and analyze the linked requirements. You can link faults to requirements by using the model canvas or the Fault Table pane. Before you begin, in the Apps tab, open Fault Analyzer and the Requirements Editor.
To link to requirements using the model canvas:
In the Requirements Editor, open or create a new requirement set with at least one requirement. See Author Requirements in MATLAB or Simulink (Requirements Toolbox).
Click the requirement.
In a saved model, click the fault badge to open the assigned fault behaviors.
Click the Fault Operations icon and select Requirements > Link to Selection in Requirements Browser.
To link to requirements from the Fault Table pane:
In the Requirements Editor, click the requirement.
In a saved model, open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.
Expand the model element list view the faults.
Right-click the fault and select Requirements > Link to Selection in Requirements Browser.
You can view the links in the Requirements Editor by clicking Show Links in the View section. In the right pane, the Source field of a link to a fault includes the fault badge and the name of the fault.
If you update the name of the fault in the model, save the model or click away from the editor to update the Source field.
You can also see the faults linked to each requirement in the requirements view. In the View section, click Show Requirements and select a requirement. Links to faults display in the Links section and include the fault badge .
Configure and Analyze Requirements Linked to Faults
After linking requirements to faults, you can perform the same modifications and analyses you can with other requirement links. For example, you can:
Customize link attributes. See Add Custom Attributes to Links (Requirements Toolbox).
Create a traceability diagram from the requirements. See Visualize Links with Traceability Diagrams (Requirements Toolbox).
Create a traceability matrix from the requirements. The faults display with the fault badge . See Track Requirement Links with a Traceability Matrix (Requirements Toolbox).
Link Faults to Simulink Test Artifacts
If you have Requirements Toolbox and Simulink Test™, you can link faults to Simulink Test objects, such as test files, test suites, and test cases.
To link test cases to faults:
In the Apps tab, click Simulink Test.
Open the Test Manager. In the Tests tab, click Simulink Test Manager.
Load or create a test suite or test file that contains at least one test case. For more information on how to create a test case, see Create a Simple Baseline Test (Simulink Test).
Click the test case.
In a saved model, open the Fault Table pane and expand the model element list.
Right-click the fault and click Requirements > Link to Current Test Case.
Link to Spreadsheet Cells and Rows in the Safety Analysis Manager
You can create links between faults and Safety Analysis Manager spreadsheet cells (since R2023b) and rows (since R2024b). To create links between faults and spreadsheet cells or rows:
Open the Safety Analysis Manager. In the Apps tab, click Safety Analysis Manager.
Create and save a new spreadsheet or open an existing spreadsheet. The spreadsheet must have at least one row and one column.
Click the cell or row index.
In a saved model, open the Fault Table pane and expand the model element list.
Right-click the fault and select Requirements > Link to Current Safety Analysis Manager selection.
Programmatically Link Faults
You can also link faults programmatically. For example, suppose that you have faults
in a model and a requirement set called my_requirements
. To link one
of the faults to the first requirement:
Get the
Fault
objects by using theSimulink.fault.findFaults
function.faults = Simulink.fault.findFaults(gcs);
Load the requirement set by using the
slreq.load
(Requirements Toolbox) function.rs = slreq.load("my_requirements");
Get the first requirement with the
find
function.req = find(rs,Index=1);
Link the requirement to the fault.
link = slreq.createLink(faults(1),req);
See Also
Apps
Functions
slreq.createLink
(Requirements Toolbox)