Main Content

Link Safety Analysis Manager Cells to Linkable Items

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

To link artifacts to the Safety Analysis Manager, you must save the document. When you link spreadsheet cells, Requirements Toolbox stores the links in a SLMX file by default.

Link Safety Analysis Manager Cells to Requirements

Link Safety Analysis Manager cells to requirements to specify design requirements in your spreadsheets. Before you begin, in the Apps tab, open Safety Analysis Manager and the Requirements Editor.

To link Safety Analysis Manager cells 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 Safety Analysis Manager, spreadsheet with at least one row and one column, right-click the cell 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. The Source field of a link to a cell includes the spreadsheet cell badge in the Source field and the name of the spreadsheet. The source also specifies the row and column of the cell after Row and Col, respectively

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

You can also see the cells linked to each requirement in the requirements view. In the View section, click Show Requirements and select a requirement. Links to cells display in the Links section with the spreadsheet cell badge . In this example image, the link is incoming to the requirement from the spreadsheet cell.

This image shows the fault badge for the Requirements Editor in the Links section when viewing the requirement link to the spreadsheet cell.

Link Spreadsheet Cells in the Safety Analysis Manager to Simulink Test Artifacts

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

For example, to link test cases to cells:

  1. In the Apps tab, click Simulink Test.

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

  3. Load or create a test suite or test file and click the test case. The test suite or test file must have 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 Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell and select Requirements > Link to Current Test Case.

Link To Simulink Fault Analyzer Artifacts

You can create links to conditionals, faults, and other spreadsheet cells in the Safety Analysis Manager.

Link to Faults

To create links to faults:

  1. Open the Fault Table pane. In the Fault Analyzer pane, in the View section, click Fault Table.

  2. Click the Fault tab.

  3. Expand the model element list and click the fault.

  4. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell and select Requirements > Link to Selection in Fault Table.

Link to Conditionals

To create links to conditionals:

  1. Open the Fault Table pane.

  2. Click the Conditional tab.

  3. Click the conditional.

  4. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell and select Requirements > Link to Selection in Fault Table.

Link to Other Spreadsheet Cells

You can link between cells in the same or different spreadsheet. To create links to other spreadsheet cells in the Safety Analysis Manager:

  1. Create and save a new spreadsheet or open an existing spreadsheet that contains at least two cells.

  2. Right-click the cell, and select Requirements > Select for Linking in Safety Analysis Manager.

  3. In the same or a different spreadsheet, right-click the other cell, and select Requirements > Link to Current Safety Analysis Manager selection.

The first cell you select has an incoming link, and the second cell has an outgoing link. If you click on the spreadsheet cell, the Property Inspector pane displays the link and the direction in the Cell tab.

An example of the link information shown in the Property Inspector pane. The link has the arrow pointing left, indicating that the link is outgoing.

Outgoing links point right, and incoming links point left.

Programmatically Link Spreadsheet Cells

You can also link spreadsheet cells in the Safety Analysis Manager programmatically. For example, suppose that you have a spreadsheet open in the Safety Analysis Manager and a requirement set called my_requirements. To link the cell in the first column and first row of a spreadsheet to the first requirement:

  1. Retrieve the Spreadsheet object associated with the open spreadsheet by using the safetyAnalysisMgr.getOpenDocuments function.

    mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;
  2. Get the SpreadsheetCell object associated with the cell in the first row and first column by using the getCell object function.

    myCell = getCell(mySpreadsheet,1,1);

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

    rs = slreq.load("my_requirements");

  4. Get the first requirement with the find function.

    req = find(rs,Index=1);

  5. Link the requirement to the cell.

    link = slreq.createLink(myCell,req);

See Also

Apps

Functions

Related Topics