Main Content

Link Conditionals to Linkable Items

If you have a Requirements Toolbox™ license, you can define the traceability between conditionals and other artifacts by linking the conditionals to linkable items in Simulink® and other external programs. Linkable items in Simulink include requirements, test cases, and spreadsheet cells in the Safety Analysis Manager. For a list of linkable items, see Linkable Items (Requirements Toolbox).

When you link conditionals, the Requirements Toolbox software stores the links in a SLMX file by default.

Link Conditionals to Requirements

Link conditionals to requirements to specify safety requirements for your design. After linking, you can configure and analyze the linked requirements. Before you begin, in the Apps tab, open Fault Analyzer and the Requirements Editor.

To link conditionals to requirements:

  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, open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.

  4. Click the Conditional tab.

  5. Right-click the conditional 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 conditional includes the conditional badge and the name of the conditional.

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

If you update the name of the conditional in the model, save the model or click away from the editor to update the Source field.

You can also see the conditionals linked to each requirement in the requirements view. In the View section, click Show Requirements and select a requirement. Links to conditionals display in the Links section and include the conditional badge .

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

Configure and Analyze Requirements Linked to Conditionals

After linking requirements to conditionals, you can perform the same kinds of modifications and analyses you can with other requirement links. For example, you can:

Link Conditionals to Simulink Test Artifacts

If you have a Requirements Toolbox and Simulink Test™ license, you can link conditionals to Simulink Test objects, such as test files, test suites, and test cases.

To link test cases to conditionals:

  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.

  6. Right-click the conditional and click Requirements > Link to Current Test Case.

Link to Spreadsheet Cells and Rows in the Safety Analysis Manager

You can create links between conditionals and Safety Analysis Manager spreadsheet cells (since R2023b) and rows (since R2024b). To create links between conditionals 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 number.

  4. In a saved model, open the Fault Table pane.

  5. Right-click the conditional that you want to link, and select Requirements > Link to Current Safety Analysis Manager selection.

Programmatically Link Conditionals

You can also link conditionals programmatically. For example, suppose that you have a set of conditionals in a model and a requirement set called my_requirements. To link one of the conditionals to the first requirement:

  1. Get the Conditional objects by using the Simulink.fault.findConditionals function.

    conditionals = Simulink.fault.findConditionals(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 conditional.

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

See Also

Apps

Functions

Related Topics