Main Content

Requirement Links

Track how your requirements relate to your model design by using Simulink® Requirements™ to create links between your requirements and various Simulink model elements, including blocks, Stateflow® objects, Simulink Test™ test objects, Simulink data dictionary entries, MATLAB® code lines, and other requirements.

You can create links to blocks and Stateflow objects from the Simulink Editor by dragging requirements from the Requirements Browser in the Requirements Perspective View. You can create links to Simulink Test test objects from the Test Manager or from the Requirements Editor. For more information on linking Simulink model elements to requirements, see Link Blocks and Requirements and Link to Test Cases from Requirements.

Requirement links are connected to the requirement SID (Session Independent Identifier) and not to its Custom ID.

Linkable Items

You can create links between requirements items, model entities, test artifacts, and code:

  • Simulink Requirements objects:

    • slreq.Requirement objects

    • slreq.Reference objects

    • slreq.Justification objects

  • Simulink entities

    • Blocks

    • Subsystems

    • Data dictionaries

  • Stateflow objects:

    • States

    • Charts and subcharts

    • Transitions

  • Simulink Test objects:

    • Test files

    • Test suites

    • Test cases

    • Iterations

    • Assessments

  • MATLAB code lines

  • System Composer™ architecture models

You can set external artifacts like URLs as link destinations by creating MATLAB structures. There are two approaches available:

  1. Create a link destination structure.

    myLinkDest = struct('domain', 'linktype_rmi_url', 'artifact', ...
     'www.mathworks.com', 'id', '')
    
    myLinkDest = 
    
      struct with fields:
    
          domain: 'linktype_rmi_url'
        artifact: 'www.mathworks.com'
              id: ''
    
    % Create a link between requirement myReq and mylinkDest
    slreq.createLink(myReq, myLinkDest);
  2. Create a requirement links data structure using rmi('createempty'). See rmi.

Link Types

To track how the elements of your design are associated with your requirements, you can specify link types for your requirement links. Link types also describe the nature of requirement-to-requirement links, such as where a requirement is derived from a higher-level requirement.

Simulink Requirements provides these link types.

TypeDescription
Related toGeneral relationship between a requirement and a model element. This link is bidirectional.
Implemented bySpecifies which model elements implement this requirement. These link types contribute to the Implementation Status metric.
Implements
Verified bySpecifies which verification model elements or test cases verify that this requirement is satisfied. These link types contribute to the Verification Status metric.
Verifies
Derived fromSpecifies which destination artifacts are derived from this source artifact.
Derives
RefinesSpecifies which destination artifacts add additional detail for the functionality specified by the source artifact.
Refined by
ConfirmsSpecifies relationship between a requirement set and an external result source. These link types contribute to the Verification Status metric.
Confirmed by

You can also create custom link types. For more information, see Define Custom Requirement and Link Types.

Requirement links have a source artifact and a destination artifact. Most of the link types are defined relative to the link direction. The Related to link type denotes a general relationship between two entities.

The Implements/Implemented by and Verifies/Verified by link types describe requirement-model relationships. Specify the source and the destination artifacts correctly for requirements with these link types because the Implementation Status and Verification Status summary metrics are derived from these link types. For more information on the Implementation Status and Verification Status summary metrics, see Review Requirement Implementation Status Metrics Data and Summarize Requirements Verification Status.

Review Requirement Links

Review your requirement links from the Links View. The Links View is available in the Requirements Editor and the Requirements Browser in the Requirements Perspective view. The Links View of the Requirements Browser in the Requirements Perspective view displays only the outgoing links from your source artifacts. Toggle between the Requirements and Links Views by using the View drop-down list in the toolbar.

When working in the Simulink Editor, you can review requirement links for individual requirements by using the Property Inspector in the Requirements Perspective view. Other links associated with your requirements are available in the Requirements View, in the Links pane. By default, all the outgoing links from a source artifact are stored in a Link Set file (.slmx). See Requirements Link Storage for more information on requirements links storage.

When you delete a link, Simulink Requirements does not preserve the CommentedBy, CommentedOn, or SID for the link.

Resolve Links

A resolved link has an available source and destination. If a link source or destination is not available, the link is unresolved. For example:

  • A link becomes unresolved if you delete a linked block from a model.

  • A link is unresolved if a source or destination file, such as a Simulink Test test file, is not loaded in memory.

In the Links View, unresolved links are denoted by . Use the setSource and setDestination methods to resolve links.

Load and Unload Link Information

All link information related to a requirement set, including link set files, Simulink models, and test files on the MATLAB or Project path are automatically loaded when you load the requirement set into memory. Link information is not automatically loaded if you save your links with the model as an embedded link set. You can also load link information by using the slreq.refreshLinkDependencies command. Link information is automatically unloaded when you unload the requirement set from memory.

See Also

| |

Related Topics