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:
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, open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.
Click the Conditional tab.
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.
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 .
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:
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 conditionals display with the conditional badge . See Track Requirement Links with a Traceability Matrix (Requirements Toolbox).
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:
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.
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:
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 number.
In a saved model, open the Fault Table pane.
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:
Get the
Conditional
objects by using theSimulink.fault.findConditionals
function.conditionals = Simulink.fault.findConditionals(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 conditional.
link = slreq.createLink(conditionals(1),req);
See Also
Apps
Functions
slreq.createLink
(Requirements Toolbox)