Main Content

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:

  1. 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).

  2. Click the requirement.

  3. In a saved model, click the fault badge to open the assigned fault behaviors.

  4. Click the Fault Operations icon and select Requirements > Link to Selection in Requirements Browser.

To link to requirements from the Fault Table pane:

  1. In the Requirements Editor, click the requirement.

  2. In a saved model, open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.

  3. Expand the model element list view the faults.

  4. 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.

This image shows the fault badge for the Requirements Editor in the Source field of a link.

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 .

This image shows the fault badge for the Requirements Editor in the Links section when viewing the requirements.

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:

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:

  1. In the Apps tab, click Simulink Test.

  2. Open the Test Manager. In the Tests tab, click Simulink Test Manager.

  3. 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).

  4. Click the test case.

  5. In a saved model, open the Fault Table pane and expand the model element list.

  6. 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:

  1. Open the Safety Analysis Manager. In the Apps tab, click Safety Analysis Manager.

  2. Create and save a new spreadsheet or open an existing spreadsheet. The spreadsheet must have at least one row and one column.

  3. Click the cell or row index.

  4. In a saved model, open the Fault Table pane and expand the model element list.

  5. 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:

  1. Get the Fault objects by using the Simulink.fault.findFaults function.

    faults = Simulink.fault.findFaults(gcs);

  2. Load the requirement set by using the slreq.load (Requirements Toolbox) function.

    rs = slreq.load("my_requirements");
  3. Get the first requirement with the find function.

    req = find(rs,Index=1);

  4. Link the requirement to the fault.

    link = slreq.createLink(faults(1),req);

See Also

Apps

Functions

Related Topics