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:
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 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
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.
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:
In the Apps tab, click Simulink Test.
Open the Test Manager. In the Tests tab, in the Test Cases section, click Simulink Test Manager.
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).
Click the test case.
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:
Open the Fault Table pane. In the Fault Analyzer pane, in the View section, click Fault Table.
Click the Fault tab.
Expand the model element list and click the fault.
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:
Open the Fault Table pane.
Click the Conditional tab.
Click the conditional.
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:
Create and save a new spreadsheet or open an existing spreadsheet that contains at least two cells.
Right-click the cell, and select Requirements > Select for Linking in Safety Analysis Manager.
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.
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:
Retrieve the
Spreadsheet
object associated with the open spreadsheet by using thesafetyAnalysisMgr.getOpenDocuments
function.mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;
Get the
SpreadsheetCell
object associated with the cell in the first row and first column by using thegetCell
object function.myCell = getCell(mySpreadsheet,1,1);
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 cell.
link = slreq.createLink(myCell,req);
See Also
Apps
Functions
slreq.createLink
(Requirements Toolbox)