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 example project by entering

    slreqCCProjectStart

    Open crs_controller from the models folder.

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

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

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

  4. 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.

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

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

    • 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.

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

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.