Documentation

Link Blocks and Requirements

You can create links between your requirements and the Simulink® blocks or Stateflow® objects that implement them. By linking between the model elements that implement requirements, you can track whether all your requirements have been implemented. You can also keep requirements and implementation in sync, for example, if a requirement changed or if the implementation causes you to revise your requirements.

In this tutorial, you use the Requirements Perspective to work with your requirements in the cruise control model. As in the Requirements Editor, you can add requirements sets and requirements in the Requirements Perspective. In both views, you can link requirements with blocks. In the Requirements Perspective, visual elements help you to see the links between requirements and blocks.

  1. In the crs_controller model, to preview the perspectives associated with the model, click the perspectives control in the lower-right corner.

  2. To open the Requirements Perspective, click the Requirements image.

    The Requirements Perspective includes the Requirements Browser, docked at the bottom of the Simulink editor. When you select a requirement, the Property Inspector displays the Simulink Requirements™ Properties pane.

  3. Link a requirement to the model element that implements it. Search for the requirement that you want to link from. In the Requirements Browser search box, enter Enable Switch Detection. As you type, matches are highlighted.

  4. To create a link, select the matching requirement and drag it onto the enbl inport block. A badge appears on the block to show that a link was created. You see badges only in the Requirements Perspective.

  5. To see more information about the requirement, click the badge and select Show.

    Clicking Show displays a requirement annotation on the model canvas. The annotation displays the ID, the summary, and the relationship between the block and the requirement. In this example, the block implements the requirement. For other possible relationships, see Requirement Links.

    • To see the requirement description, double-click the annotation.

    • To edit the requirement, right-click the annotation and select Select in browser. The requirement properties appear in the Property Inspector, where you can edit them.

  6. Exit the Requirements Perspective. Click the perspectives control and click the requirements image.

Was this topic helpful?