Main Content

Link Blocks and Requirements

You can track requirements implementation by linking requirements to model elements that implement the requirements. Linking also enables change notification, so that you can review and act on changes to requirements or models.

In this tutorial, link requirements to a model by using the model requirements perspective. Visual elements highlight links between requirements and blocks.

  1. Open the CruiseRequirementsExample project. At the MATLAB® command prompt, enter:


  2. Open the crs_controller model from the models folder. At the MATLAB command prompt, enter:

  3. In the model canvas, click the perspectives control in the lower-right corner.

    Close up of the lower-right corner of the Simulink canvas. The mouse points to the perspectives button, and the tooltip is displayed.

  4. Open the requirements perspective by clicking the Requirements icon.

    Close up of the lower-right corner of the Simulink canvas, showin the mouse pointing to the Show Perspectives view button

    The Requirements Browser appears at the bottom of the model canvas. When you select a requirement, the Property Inspector displays the requirement's properties.

  5. Link a requirement to a model element:

    1. In the Requirements Browser, search for Enable Switch Detection.

    2. Link to the enbl Inport block by clicking and dragging the requirement to the block. An annotation template appears.

    3. Place the requirement annotation by clicking on the canvas. Create a link without an annotation by clicking outside the canvas.

    Close up of a Simulink block with an Implements link to a requirement named Enable Switch Detection

  6. The block displays a link badge. To display information about the requirement, click the badge and select Show.

    Simulink block after the requirements badge was clicked, showing the requirement and the Show button

    Clicking Show displays the requirement ID, requirement summary, and link type. For information on link types, see Create and Store Links.

    Simulink showing the annotation on the canvas

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

    • To edit the requirement, right-click the annotation and select Select in Requirements Browser. Edit the requirement properties in the Property Inspector.

  7. Exit the requirements perspective. Click the perspectives control and click the requirements icon.

    Lower-right corner of the canvas showing the mouse pointing to the Requirements Perspective to exit the perspective

Work with Simulink Annotations

Convert Simulink Annotations to Requirements

You can convert the annotations in your Simulink® models to requirements by using the context menu in the Requirements Perspective View and by using the API. See slreq.convertAnnotation for more information on converting annotations to requirements by using the API.

To convert annotations to requirements by using the context menu in the Requirements Perspective View:

  1. Open the Simulink model and enter the Requirements Perspective View.

  2. Select a requirement set from the Requirements Browser. This is the destination requirement set for the new requirement.

  3. Right click the annotation you want to convert to a requirement and click Convert to Requirement.

  4. The annotation is converted to a requirement and is linked to the system or subsystem at which the annotation was present.

Link Requirements to Simulink Annotations

Use the Requirements Perspective View to link requirements to text and area annotations on the Simulink Editor. To create a link, select a requirement and drag it onto the annotation. If you link requirements to an area annotation, a badge appears on the annotation to show that the link was created. You see badges only in the Requirements Perspective View. To see more information about the requirement, click the badge and select Show.

Related Topics